Module array

Source

Functionsยง

append_vec
arr_empty
arr_eq
arr_nonempty
contains
contains(genericArrayIn, genericValue) โ€“ specialized to strings & ints for now. For a more dynamic approach weโ€™d pass Vec<Value> and a Value. We implement a generic helper where T: PartialEq.
count
count(array)
first
first(array)
index_of
js_compat_array_slice
last
last(array)
normalize_bounds ๐Ÿ”’
one_bool
Convert a single primitive into a one-element array (abFromB / anFromN / asFromS).
one_i32
one_string
pop
JS pop(array) -> subset(array, 0, -2) meaning drop last element. We replicate safe behavior (no negative wrap).
print_arr
Wrapper kept for compatibility: print_arr -> str_print_arr
print_array
Wrapper kept for compatibility: print_array -> str_print_arr
set_element
setElement(array, index, value) โ€“ panics if out of range except allowing index == len (append) in the original? JS code forbade index > length. If index == len we append.
shift
shift(array) -> subset(array, 1, -1) => drop first element
slice_inclusive_bool
slice_inclusive_i32
slice_inclusive_string
str_print_arr
str_print_array
Wrapper kept for compatibility: str_print_array -> str_print_arr
subset
Close translation of StageL anSubset.
sum_array