lodashWorking with Lists and Arrays


Syntax

  • _.map(collection, Function) => newCollection
  • _.filter(collection, Predicate) => newCollection
  • _.some(collection, Predicate) => true or false
  • _.reduce(collection, BiFunction, seed) => accumulated value

Parameters

ParameterMeaning
CollectionAn iterable group of elements. This can be an array or an object.
FunctionA function that takes 1 input, and returns one output.
BiFunctionA function that takes 2 inputs, and returns one output.
PredicateA function that takes 1 input, and returns a boolean value.
seedThe initial value for a reduction operation. When this is left out, the first element of the collection is used instead.