Description of the array utilities.
import { array } from '@webalternatif/js-core'Checks if a value exists in an array or an object
valueany the searched valuearr(Object | Array) the arrayindexnumber if provided, search from this index (optional, default0)strictboolean if true, search is done with strict equality (optional, defaultfalse)
inArray(2, [1, 2, 3]) => trueinArray({a: 1}, {a: 1, b: 2}) // => trueinArray(5, [1, 2, 3]) // => falseReturns boolean
Returns the first index at which a given element can be found in an array or a string. or -1 if it is not present.
arr(Array<any> | string) The array to search ineltany The element to search forfromnumber? The index to start the search from. Can be negative. (optional, default0)
Returns number The index of the element, or -1 if not found
Returns the last index at which a given element can be found in an array or a string. or -1 if it is not present.
arr(Array<any> | string) The array to search ineltany The element to search forfromnumber? The index to start the search from. Can be negative. (optional, default-1)
Returns number The index of the element, or -1 if not found