-
Notifications
You must be signed in to change notification settings - Fork 0
Collection.API
A bare minimum set of utilities for working with collections
-
Iterate over each element in a collection.
Name Type Description collectionobject | array The collection to iterate over can be either an array or an object
callbackcallback(index, element) is executed for each element in the collection
-
Return a new collection being a filtered subset of elements from a collection
Name Type Argument Default Description collectionobject | array The collection to iterate over can be either an array or an object
callbackcallback(element) Predicate callback is executed for each element in the collection and must return true if the element will be included in the filter
emptyObject | Array <optional>
empty array You can provide an empty array or object to be populated by the filter procedure. By default the returned collection is an array however you can populate properties on an object by specifying an object as the empty.
collection
- Type
- object | array
-
Find the first item satisfied by predicate callback in the provided collection
Name Type Description collectionobject | array The collection to iterate over can be either an array or an object
callbackcallback(element) Predicate callback is executed for each element in the collection and must return true if the element will be included in the filter
returns the found element or null if no element wa found
- Type
- * | null