Collections

You can check the module import here.

empty

Returns true if the collection is empty.

File

Usage

Returns the first element of the collection, or undefined if the collection is empty.

File

Usage

initial

Returns every element but the last of the collection or empty array if the collection is empty.

File

Usage

join

Joins an array into a string.

File

Usage

last

Returns the last element of the collection or undefined if the collection is empty.

File

Usage

tail

Returns every elements but the first of the collection or empty array if the collection is empty.

File

Usage

uniq

Returns the collection keeping only one duplicate.

File

Usage

without

Returns the collection without the specified elements.

File

Usage

intersection

Returns the intersection of two collection, works with deep equal.

File

Usage

union

Returns the union of two collection, works with deep equal.

File

Usage

range

Returns a range of number with a given size (default: 0) and start (default: 1).

The value on the left hand size does not matter, it is ignored.

File

Usage

map

Returns the collection that is passed through a map function. If no function is provided, the collection is returned unchanged.

File

Usage

pluck

Returns an array of the given property of the object in the array.

File

Usage

where

Filter an array with a given function or a property shorthand.

File

Usage

firstOrDefault

This pipe behaves exactly like where but only return the first element when is found. A default value can be provided if no such element exists.

File

Usage

orderBy

Returns a new ordered array. You can order by multiple properties, ascending and descending.

File

Usage

reverse

Returns a reversed array.

File

Usage

count

Returns the length of the collection. Useful when used with other pipes, otherwise, use the length property. Works also for object and string.

File

Usage

some

Returns true if at least one of the item in the collections pass the predicate.

File

Usage

every

Returns true if every item in the collections pass the predicate.

File

Usage

shuffle

Shuffles a collection.

File

Usage

take

Take the top n items of an array.

File

Usage

takeUntil

Take until the condition is met.

File

Usage

takeWhile

Take while the condition is met.

File

Usage

drop

Drop the last n items of an array.

File

Usage

deep

The deep pipe is different from other pipes, it doesn't return new data. It wraps data for other pipes to work with deep comparaisons.

File

Usage

chunk

The chunk pipe breaks the array into multiple, smaller arrays of a given size:

File

Usage

flatten

The flatten flattens an array. It can be used with the deep pipe.

File

Usage

Last updated

Was this helpful?