Array Module
Type aliases
The return value of the binarySearch operator, contains in order
Type parameters
-
T: unknown
The type of the value being searched for
-
K: unknown
The type of value in the search Array
A function used to map values to a modified value, either of the same type (String.toUpperCase) or of a different type (Number.parseInt)
Type parameters
-
T = unknown
The type of value as input to the method
-
K = T | unknown
The type of value returned from the method
Type declaration
-
-
Parameters
-
value: T
Returns K
-
-
A function that takes one or more parameters and returns a boolean value based on the function calculation
Type parameters
-
T: unknown
The type of the value being checked
Type declaration
-
-
Parameters
-
Rest ...args: T[]
Returns boolean
-
-
A function used to sort data using a calculation defined in the method, returning either -1
, 0
or 1
based on
the ordering requirements
Type parameters
-
T: unknown
The Type of the value to sort
Type declaration
-
-
Parameters
-
first: T
-
second: T
Returns number
-
-
Filter Functions
-
Returns an Observable that emits an Array containing unique values from the source that are not in the
compare
parameterType parameters
-
T: unknown
Parameters
-
compare: Subscribable<Iterable<T>> | Iterable<T>
Array or Set value to compare the source value with
Returns OperatorFunction < Iterable < T > , T [] >
Observable that emits an Array containing items from the source not in the comparison value
-
-
Returns an Observable that emits an tuple containing two Array both containing differences in the source and
compare
value. The first array contains items from the source not contained incompare
and the second values fromcompare
not in the source.Type parameters
-
T: unknown
Parameters
-
compare: Subscribable<Iterable<T>> | Iterable<T>
Array or Set value to compare the source value with
Returns OperatorFunction < Iterable < T > , T [] [] >
Observable that emits an tuple containing two Array values with the source difference and input difference
-
-
Returns an Observable Array containing filtered values that are not in the provided input Array or Set
Type parameters
-
T: unknown
Parameters
-
compare: Subscribable<Iterable<T>> | Iterable<T>
Array or Set value to compare the source value with
Returns OperatorFunction < Iterable < T > , T [] >
An Observable that emits an Array with the difference between source and input
-
-
Returns an Observable that emits an array when all values in the source array return truthy using Array.every. When working with data, if the array contains numbers
0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy value of array values
Returns OperatorFunction < Iterable < T > , T [] >
An Observable that emits a boolean when all values in source array return truthy with the PredicateFn
-
-
Returns an Observable Array containing filtered values that are in both the source in the provided input Array or Set
Type parameters
-
T: unknown
Parameters
-
input: Subscribable<Iterable<T>> | Iterable<T>
Array or Set or Observable value to compare against for the intersection
Returns OperatorFunction < Iterable < T > , T [] >
An Observable that emits an Array of the intersection of input and source arrays.
-
-
Returns an Observable that emits an array when one of the values in the source array return truthy using Array.some When working with data, if the array contains numbers
0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy value of array values
Returns OperatorFunction < Iterable < T > , T [] >
An Observable that emits a boolean when all values in source array return truthy with the PredicateFn
-
-
Returns an Observable value of the first truthy value found in a source array, or
undefined
using Array.find. When working with data, if the array contains numbers0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy value of array values
Returns OperatorFunction < Iterable < T > , T | undefined >
An Observable that emits the first found value from the array, or
undefined
-
-
Returns an Observable array of truthy values from a source Array or Set When working with data, if the array contains numbers
0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy value of array values
Returns OperatorFunction < Iterable < T > , T [] >
An Observable that emits an array containing all truthy values from a source array
-
-
Returns an Observable value of the last truthy value found in a source array, or
undefined
using Array.find When working with data, if the array contains numbers0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy value of array values
Returns OperatorFunction < Iterable < T > , T | undefined >
An Observable that emits the last found value from the array, or
undefined
-
-
Returns an Observable Array containing unique values that are in both the source and provided input Array or Set
Type parameters
-
T: unknown
Parameters
-
input: Subscribable<Iterable<T>> | Iterable<T>
Array or Set or Observable value to compare against for the intersection
Returns OperatorFunction < Iterable < T > , T [] >
An Observable that emits an array of the intersection of input and source arrays.
-
Map Functions
-
Returns an Observable that emits an Array from a Map
Type parameters
Parameters
-
input: Subscribable<Iterable<Map<K, V>> | Map<K, V>> | Iterable<Map<K, V>> | Map<K, V>
Input to create the emit values from, can be argument list of Map, an array of Map or an Observable or Promise source
Returns Observable < [ K , V ] [] >
Observable that emits an Array from the input Map
-
-
Returns an Observable that emits an array from a source Map object.
Type parameters
Returns OperatorFunction < Map < K , T > , [ K , T ] [] >
Observable that emits a Array from a source Map
-
Returns an Observable that emits a Map object from a source array.
Type parameters
Returns OperatorFunction < [ K , V ] [] , Map < K , V > >
Observable that emits a Map from a source array
Modify Functions
-
Returns an Observable array of values filled with Array.fill. Using the source array length, some or all the values are replaced with the
fillWith
parameter.Type parameters
-
T: unknown
-
K: unknown
Parameters
-
fillWith: Subscribable<K> | K
The value to fill the array with
-
startIndex: Subscribable<number> | number = 0
Optional start index to fill the array from
-
Optional endIndex: Subscribable<number> | number
Optional index of the item to stop filling at, the last item filled is
fillTo - 1
Returns OperatorFunction < Iterable < T > , K [] >
An Observable that emits an Array of values where some or all of the source array values are replaced with the
fillValue
-
-
Returns an Observable array where the source array contains boolean values, and flips the value to the opposite boolean.
Returns OperatorFunction < Iterable < boolean > , boolean [] >
Observable array of boolean values that are flipped from their original value
-
Returns an Observable that emits a joining the values of the Array or Set using the
separator
character using Array.joinType parameters
-
T: unknown
Parameters
-
separator: Subscribable<string> | string = ' '
Separator to be used to join strings. Default value is a space (
Returns OperatorFunction < Iterable < T > , string >
Observable string from the joined values in the source array
-
-
Returns an Observable that emits array taking the source and running the result of Array.reverse
Type parameters
-
T: unknown
Returns OperatorFunction < Iterable < T > , T [] >
Observable that emits an array which is reversed from the source array
-
-
Returns an Observable that emits an array taking a source array and randomly shuffling the elements
Type parameters
-
T: unknown
Returns OperatorFunction < Iterable < T > , T [] >
Observable that emits an array of values shuffled from the source array
-
-
Returns an Observable that emits an array of sorted values from the source Array or Set using the SortFn
Type parameters
-
T: unknown
Parameters
-
Optional sortFn: SortFn<T>
Optional SortFn used to sort the array, if not provided the
defaultSortFn
is used.
Returns OperatorFunction < Iterable < T > , T [] >
Observable array of values from source array sorted via SortFn
-
-
Returns an Observable that emits an array of sorted mapped values from a source array where values are mapped to type
K
using a MapFn.Type parameters
-
T: unknown
-
K: unknown
The type of data in the emitted array
Parameters
-
mapFn: MapFn<T, K>
The MapFn to map the value in the array
-
Optional sortFn: SortFn<T>
Optional SortFn used to sort the array, if not provided the
defaultSortFn
is used.
Returns OperatorFunction < Iterable < T > , K [] >
Observable that emits an array of sorted mapped values
-
Object Functions
-
Returns an Observable that emits an Array from a source Object using Object.entries, the Array contains tuples of the key as a string and the value
Type parameters
-
K: string | number | symbol
The key type of the source Object
-
T: unknown
The value type of the source Object
Returns OperatorFunction < Record < K , T > , [ string , T ] [] >
Observable that emits a Array from a source Object entries
-
-
Returns an Observable that emits an array from a source Object using Object.keys, the array contains the object keys as strings.
Type parameters
-
K: string | number | symbol
The key type of the source Object
-
T: unknown
The value type of the source Object
Returns OperatorFunction < Record < K , T > , string [] >
Observable that emits a Array of strings from a source Object keys
-
Query Functions
-
Returns an Observable that emits a BinarySearchResult. It take a source Array or Set and runs a SortFn over it, then searches it for the passed
search
value. TheBinarySearchResult
contains the index in the sorted array, the value searched and the sorted and unsorted array. If not found the index is-1
.Type parameters
-
T: unknown
The type of the search value
-
V: unknown
The type of item in the Array if different to search type
Parameters
-
search: Subscribable<T> | T
The value to search for in the Array
-
Optional property: Subscribable<string | number> | string | number
Optional property for searching tuples and objects - if an tuple use a
number
if anObject
use astring
-
Optional sortFn: SortFn<V>
Optional SortFn for sorting more complex types
Returns OperatorFunction < Iterable < V > , BinarySearchResult < T , V > >
An Observable that emits a BinarySearchResult
-
-
Returns an Observable that emits a boolean when all values in the source array return truthy using Array.every. When working with data, if the array contains numbers
0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy value of Array values
Returns OperatorFunction < Iterable < T > , boolean >
An Observable that emits a boolean when all values in source array return truthy
-
-
Returns an Observable number which is the index of the first value found in an array using Array.findIndex When working with data, if the array contains numbers
0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy or falsy value of array values
Returns OperatorFunction < Iterable < T > , number >
An Observable that emits a number value, the index of first value where PredicateFn is true
-
-
Returns an Observable Number if the input is a single value, or Array of numbers in the input is an Array. These are the index numbers of first truthy value in the source array using Array.indexOf
Type parameters
-
T: unknown
Parameters
-
input: Subscribable<Iterable<T> | T> | Iterable<T> | T
A value or array of values to get the index of in the source array
-
Optional startIndex: Subscribable<number> | number
Optional index to start searching from in the array, starts from
0
Returns OperatorFunction < Iterable < T > , number [] >
Observable number or array of numbers containing the index of the first found value
-
-
Returns an Observable that emits a boolean value if the source Observable Array or Set has equal non-duplicate content of the input Array or Set
Type parameters
-
T: unknown
Parameters
-
input: Subscribable<Iterable<T>> | Iterable<T>
Returns OperatorFunction < Iterable < T > , boolean >
Observable that emits a boolean of the source array has equal content to the input array
-
-
Returns an Observable that emits a boolean value if the source Observable Array or Set is a subset of the input Array or Set
Type parameters
-
T: unknown
Parameters
-
input: Subscribable<Iterable<T>> | Iterable<T>
Returns OperatorFunction < Iterable < T > , boolean >
Observable that emits a boolean of the source array being a subset of the input array
-
-
Returns an Observable that emits a boolean value if the source Observable Array or Set is a superset of the input Array or Set
Type parameters
-
T: unknown
Parameters
-
input: Subscribable<Iterable<T>> | Iterable<T>
Returns OperatorFunction < Iterable < T > , boolean >
Observable that emits a boolean of the source array being a superset of the input array
-
-
Returns an Observable number or array of numbers. These are the index numbers of first truthy value in the source array using Array.lastIndexOf
Type parameters
-
T: unknown
Parameters
-
input: Subscribable<Iterable<T> | T> | Iterable<T> | T
A value or array of values to get the index of in the source array
-
Optional fromIndex: Subscribable<number> | number
Optional index to start searching from in the array
Returns OperatorFunction < Iterable < T > , number [] >
Observable number or array of numbers containing the index of the last found value
-
-
Returns an Observable that emits a boolean when all values in the source Array or Set return truthy using Array.some When working with data, if the array contains numbers
0
will be returned as a value to the PredicateFn, but all other falsy values will be ignoredType parameters
-
T: unknown
Parameters
-
Optional predicate: PredicateFn<T>
Optional PredicateFn used to get a truthy value of array values
Returns OperatorFunction < Iterable < T > , boolean >
An Observable that emits a boolean when all values in source array return truthy
-
Set Functions
-
Returns an Observable that emits an Array from a Set
Type parameters
-
T: unknown
The type of value contained in the Set
Parameters
-
input: Subscribable<Iterable<Set<T>> | Set<T>> | Iterable<Set<T>> | Set<T>
Input to create the emit values from, can be argument list of Set, an array of Set or an Observable or Promise source
Returns Observable < T [] >
Observable that emits an Array from the input Set
-
-
Returns an Observable that emits an Array from a source Set.
Type parameters
-
T: unknown
The type of value contained in the Set
Returns OperatorFunction < Set < T > , T [] >
Observable that emits a Array from a source Set
-
-
Returns an Observable that emits a Set from a source Array.
Type parameters
-
T: unknown
Returns OperatorFunction < T [] , Set < T > >
Observable that emits a Set from a source Array
-
Generated using TypeDoc, the 18/11/2022 at 13:22:57
The RxJS Ninja Array module contains operators for working with, and returning Array values. There are also methods for working with Set, Map and Object converting to and from Array types.