filter(callback, thisp?)

Returns an array with each value from this collection that passes the given test.

The given callback receives the value for each entry, the key or index, and the collection itself. If the return value of the callback is truthy, the value will be included in the resulting array.

The index of the value will be ignored and the resulting array will be compact, even if this collection is an array with holes. Positions in this array that are holes will not be visited.

On collections


  • filter(callback)
  • filter(callback, thisp)


  • forEach(callback, thisp?)

    Calls the callback for each entry in the collection.

  • map(callback, thisp?)

    Returns an array of the respective return values of a callback for each entry in this collection.

  • group(callback, thisp?, equals?)

    Returns an array of [key, class] entries where every value from the collection is placed into the same equivalence class if they return the same key through the given callback.

  • reduce(callback, basis)

    Aggregates every value in this collection with the result collected up to that index.