lodash v0.0.3 Lodash.Collection

Specialized functions to manipulate enumerable.

Summary

Functions

Create an enumerable with all falsey values removed

Create an enumerable from collection1 whose values are not included collection2

The method is like difference except that it accepts interatee to compare

Create an enumerable of unique values that are included in all given from collection1, collection2

The method is like intersection except that it accepts interatee to compare

Remove all given values from collection which has the same value as key

The method is like pull except it from collection

Create an enumerable of unique values from all given values

The method is like union except it accepts interatee

Functions

compact(collection)

Create an enumerable with all falsey values removed.

Examples

iex> Lodash.Collection.compact([1, 2, nil])
[1, 2]
difference(collection1, collection2)

Create an enumerable from collection1 whose values are not included collection2.

Examples

iex> Lodash.Collection.difference([1, 2], [2, 3])
[1]
difference_by(collection1, collection2, func)

The method is like difference except that it accepts interatee to compare.

Examples

iex> Lodash.Collection.difference_by([1.1, 2.2], [1.2, 3.0], fn(x, y) -> Float.floor(x) == Float.floor(y) end)
[2.2]
intersection(collection1, collection2)

Create an enumerable of unique values that are included in all given from collection1, collection2.

Examples

iex> Lodash.Collection.intersection([1, 2], [2, 3])
[2]
intersection_by(collection1, collection2, func)

The method is like intersection except that it accepts interatee to compare

Examples

iex> Lodash.Collection.intersection_by([1.1, 2.2], [1.2, 3.0], fn(x, y) -> Float.floor(x) == Float.floor(y) end)
[1.1]
pull(collection, key)

Remove all given values from collection which has the same value as key

Examples

iex> Lodash.Collection.pull([1, 2], 1)
[2]
pull_all(collection1, collection2)

The method is like pull except it from collection.

Examples

iex> Lodash.Collection.pull_all([1, 2, 3], [3, 4])
[1, 2]
union(collection1, collection2)

Create an enumerable of unique values from all given values.

Examples

iex> Lodash.Collection.union([1, 2], [2, 3])
[1, 2, 3]
union_by(collection1, collection2, func)

The method is like union except it accepts interatee.

Examples

iex> Lodash.Collection.union_by([1, 2, 3], [4, 5, 6], fn(x) -> rem(x, 2) == 0 end)
[1, 2]