Creates new readonly wrapper for the given array signal.
Returns the index of the first element in the array where predicate is true, and -1 otherwise.
Called once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.
Optional
thisArg: unknownOptional object to which the this
keyword can refer in the predicate function. Defaults to undefined
.
The index of the first found element or -1 if none.
Calls the given callback function on each element of the array to map the array element to something different. Then flattens the result into a new array. This is identical to a map followed by flat with depth 1.
A function that accepts up to three arguments (value, index, array). Called one time for each element in the array. Must return the mapped value.
Optional
thisArg: ThisOptional object to which the this
keyword can refer in the callback function. Defaults to undefined
.
New array with mapped and flattened valued.
Performs the specified action for each element in the array.
A function that accepts up to three arguments (value, index and the array itself). Called one time for each element in the array.
Optional
thisArg: unknownOptional object to which the this
keyword can refer in the callback function. Defaults to undefined
.
Returns the current signal value version. This value is used to determine if a dependency has changed. The most simple implementation would be a number
which is incremented every time the signal value really has changed. The version type doesn't matter but must be comparable with ===
.
The current signal value version.
Determines whether an array includes a certain element, returning true or false as appropriate.
The element to search for.
Optional
fromIndex: numberOptional position in this array at which to begin searching. Defaults to 0.
True if array includes the element, false if not.
Returns the index of the first occurrence of an element in the array.
The element to locate in the array.
Optional
fromIndex: numberThe array index at which to begin the search. If omitted, the search starts at index 0.
The index of the first occurrence of the given element, or -1 if not found.
Checks if signal value is still valid. When signal has no dependencies then this method can always return true. If signal has dependencies then it must check if any dependency has changed or became invalid. If yes, then this method must return false and the signal will be re-validated by calling (). If all dependency are valid/unchanged then this method must return true to indicate that the signal value is still valid.
True if signal value is valid, false if it must be re-validated.
Adds all the elements of the array separated by the specified separator string.
Optional
separator: stringA string used to separate one element of an array from the next in the resulting string. If omitted, the array elements are separated with a comma.
The joined string.
Returns the index of the last occurrence of an element in the array.
The element to locate in the array.
The array index at which to begin the search. If omitted, the search starts at the last index in the array.
The index of the last occurrence of the given element, or -1 if not found.
Calls a defined callback function on each element of the array and returns an array that contains the results.
A function that accepts up to three arguments (value, index and the array itself) and returns the mapped value for the array element. Called one time for each element in the array.
Optional
thisArg: unknownOptional object to which the this
keyword can refer in the callback function. Defaults to undefined
.
A new array with the mapped elements.
Returns a section of the array.
Optional
start: numberThe beginning of the specified portion of the array.
Optional
end: numberOptional end of the specified portion of the array. This is exclusive of the element at the index 'end'. Defaults to the array length if not specified.
The sliced section of the array.
Determines whether the specified callback function returns true for any element of the array.
A function that accepts up to three arguments (value, index and the array itself). Called for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.
Optional
thisArg: unknownOptional object to which the this
keyword can refer in the predicate function. Defaults to undefined
.
True if at least one element satisfies the specified test, false if none does.
Called when () returned false and the current value of this signal is needed. Must compute/fetch and cache the new value so the next call to () returns a valid value. When signal has no dependencies and () is implemented to always return true then this method can stay empty as it has nothing to validate/update.
Readonly wrapper for an array signal.