From 0f4c7e807c91615ba0657b61e32a4fad1c136e73 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:25:22 -0800 Subject: [PATCH] a few more --- packages/svelte/src/internal/client/each.js | 14 +++++++------- packages/svelte/src/internal/client/runtime.js | 12 ++++++------ packages/svelte/src/internal/client/transitions.js | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/svelte/src/internal/client/each.js b/packages/svelte/src/internal/client/each.js index 2d39abe4ad..a99b0e8e8a 100644 --- a/packages/svelte/src/internal/client/each.js +++ b/packages/svelte/src/internal/client/each.js @@ -371,7 +371,7 @@ function reconcile_tracked_array( if (is_controlled && a) { clear_text_content(dom); } - while (a > 0) { + while (a) { block = a_blocks[--a]; destroy_each_item_block(block, active_transitions, apply_transitions, is_controlled); } @@ -387,7 +387,7 @@ function reconcile_tracked_array( /** @type {Node} */ var hydrating_node = current_hydration_fragment[0]; - while (b > 0) { + while (b) { // Hydrate block idx = b_end - --b; item = array[idx]; @@ -406,7 +406,7 @@ function reconcile_tracked_array( } } else if (!a) { // Create new blocks - while (b > 0) { + while (b) { idx = b_end - --b; item = array[idx]; key = is_computed_key ? keys[idx] : item; @@ -502,7 +502,7 @@ function reconcile_tracked_array( var should_create; if (is_animated) { var i = b_length; - while (i-- > 0) { + while (i--) { b_end = i + start; a = sources[i]; if (pos === MOVED_BLOCK) { @@ -514,7 +514,7 @@ function reconcile_tracked_array( } var last_block; var last_sibling; - while (b_length-- > 0) { + while (b_length--) { b_end = b_length + start; a = sources[b_length]; should_create = a === -1; @@ -597,7 +597,7 @@ function mark_lis(a) { } if (k < a[index[lo]]) { - if (lo > 0) { + if (lo) { parent[i] = index[lo - 1]; } index[lo] = i; @@ -657,7 +657,7 @@ function get_first_child(block) { function destroy_active_transition_blocks(active_transitions) { var length = active_transitions.length; - if (length > 0) { + if (length) { var i = 0; var block; var transition; diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index cb04f9c96b..c2b88ab529 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -371,7 +371,7 @@ function execute_signal_fn(signal) { } } - if (dependencies && current_dependencies_index > 0) { + if (dependencies && current_dependencies_index) { dependencies.length = current_dependencies_index + current_dependencies.length; for (i = 0; i < current_dependencies.length; i++) { dependencies[current_dependencies_index + i] = current_dependencies[i]; @@ -520,7 +520,7 @@ export function execute_effect(signal) { if ( is_runes(component_context) && // Don't rerun pre effects more than once to accomodate for "$: only runs once" behavior signal.f & PRE_EFFECT && - current_queued_pre_and_render_effects.length > 0 + current_queued_pre_and_render_effects.length ) { flush_local_pre_effects(component_context); } @@ -545,7 +545,7 @@ function infinite_loop_guard() { */ function flush_queued_effects(effects) { const length = effects.length; - if (length > 0) { + if (length) { infinite_loop_guard(); let i; for (i = 0; i < length; i++) { @@ -566,7 +566,7 @@ function flush_queued_effects(effects) { function process_microtask() { is_micro_task_queued = false; - if (current_queued_microtasks.length > 0) { + if (current_queued_microtasks.length) { const tasks = current_queued_microtasks.slice(); current_queued_microtasks = []; run_all(tasks); @@ -698,7 +698,7 @@ export function flushSync(fn) { if (fn) { fn(); } - if (current_queued_pre_and_render_effects.length > 0 || effects.length > 0) { + if (current_queued_pre_and_render_effects.length || effects.length) { flushSync(); } if (is_micro_task_queued) { @@ -1551,7 +1551,7 @@ export function prop(props, key, flags, initial) { get(inner_current_value); } - if (arguments.length > 0) { + if (arguments.length) { if (mutation || (immutable ? value !== current : safe_not_equal(value, current))) { from_child = true; set(inner_current_value, mutation ? current : value); diff --git a/packages/svelte/src/internal/client/transitions.js b/packages/svelte/src/internal/client/transitions.js index 3317520e6d..92ca854207 100644 --- a/packages/svelte/src/internal/client/transitions.js +++ b/packages/svelte/src/internal/client/transitions.js @@ -569,7 +569,7 @@ export function trigger_transitions(transitions, target_direction, from) { mark_subtree_inert(transition.e, true); } } - if (outros.length > 0) { + if (outros.length) { // Defer the outros to a microtask const e = managed_pre_effect(() => { destroy_signal(e);