Optional
items: MaybeArray<T>The length of the collection.
Protected
_allProtected
Determine whether all the values in this are objects.
Protected
_newProtected
Workaround to return a new current class.
Optional
items: MaybeArray<T>Private
_setPrivate
Set the values in context.
Chunk the collection into chunks of the given size.
Chunk the collection by the specified key.
Array.prototype.concat
Rest
...items: ConcatArray<T>[]Array.prototype.copyWithin
Optional
end: numberRemove all items that are deep equal to the argument.
Diff the collection with the given items.
Print the collection values to the console.
Optional
message: stringOnly keep the duplicated values in the collection. Optionally if all items are object compare by the given key or function.
Optional
key: string | ((obj: T) => T)Array.prototype.every
Optional
thisArg: anyOptional
thisArg: anyArray.prototype.fill
Optional
start: numberOptional
end: numberArray.prototype.filter
Optional
thisArg: anyArray.prototype.find
Optional
thisArg: anyArray.prototype.findIndex
Optional
thisArg: anyReturn the first element in the collection, if callback given the first element that passes the truth test. Otherwise, undefined.
Optional
callback: ((item: T, index: number) => boolean)Array.prototype.flat
Array.prototype.flatMap
Optional
thisArg: ThisOptional
thisArg: any[]Private
getIntersect the collection with the given values.
Return the last element in the collection, if callback given the last element that passes the truth test. Otherwise, undefined.
Optional
callback: ((item: T, index: number) => boolean)Array.prototype.map
Optional
thisArg: anyOnly keep every nth element in the collection.
Order the collection by given configurations(s)
Rest
...additional: T extends Record<PropertyKey, any> ? Order<T>[] : neverPad collection to the specified length with a value. Negative length will pad the beginning of the collection.
Optional
value: T | (() => T)Sort the items into a collection of their own based on weather they pass the given truthfulness test.
Pass the collection to a given function.
Get a collection with the values of a given key.
Return a random element(s) from the collection.
Array.prototype.reduce
Optional
initialValue: TArray.prototype.reduceRight
Optional
initialValue: TArray.prototype.reverse
Randomise the order of elements in the collection using the algorithm.
Skip items in the collection until the specified count from the start or end based on the argument.
Skip items in the collection until the given closure with the current item resolves to false.
Skip items in the collection while the given closure with the current item resolves to true.
Array.prototype.slice
Optional
start: numberOptional
end: numberArray.prototype.some
Optional
thisArg: anyArray.prototype.sort
Optional
compareFn: ((a: T, b: T) => number)Array.prototype.splice
Rest
...items: T[]Return the specified number of elements from the collection's start or end on negative argument.
Take items in the collection until the given closure with the current item resolves to false.
Take items in the collection while the given closure with the current item resolves to true.
Pass a clone of the collection to a given function.
Join the collection and one or more iterables without overlapping values.
Rest
...iterables: (Collection<T> | MaybeArray<T>)[]De-duplicate the collection. Optionally find duplicates by key or the return value of a method called with the element.
Optional
key: string | ((obj: T) => T)Call a callback on the collection unless the first argument is Boolean(true) or a closure called with the collection resolving to a value converted to boolean.
Call a callback on the collection when the first argument is Boolean(true) or a closure called with the collection resolving to a value converted to boolean.
Call the given callback with the collection if the collection is empty.
Call the given callback with the collection if the collection is not empty.
Filter out null and undefined values.
Static
isAsserts whether the given value is an instance of Collection.
Static
timesCreate a new collection from the evaluated callback or value the given number of times.
Generated using TypeDoc
The constructor.