Protected constructorOptional models: MaybeArray<Ancestralised<T, CT>>The key that will include descendants.
Protected childrenThe name of the attribute that includes the related models.
The length of the collection.
Static depthThe name of the key that will be set when arranging the items in a tree structure.
Protected _allProtected
Determine whether all the values in this are objects.
Protected _getProtected
Accepts ModelCollection, array of models, numbers and strings in array format. All other values are discarded. Returns a collection of ids in a string format.
Protected _newProtected
Workaround to return a new current class.
Optional items: MaybeArray<Ancestralised<T, CT>>Private _setPrivate
Set the values in context.
Protected _throwChunk the collection into chunks of the given size.
Chunk the collection by the specified key.
Array.prototype.concat
Rest ...items: ConcatArray<Ancestralised<T, CT>>[]Array.prototype.copyWithin
Optional end: numberRemove all models that are same as the argument based on the Model's 'is()' method.
Model#is
Return only the models that are not in both the argument and in the collection.
Print the collection values to the console.
Optional message: stringOnly keep one instance of duplicated values in the collection. Optionally find duplicates by key, method name or passed in method. If key is undefined on the model, fall back to model check.
Optional key: SimpleAttributeKeys<Ancestralised<T, CT>> | ((model) => U)Array.prototype.every
Optional thisArg: anyOptional thisArg: anyReturn all models except models with ids from the arguments.
Array.prototype.fill
Optional start: numberOptional end: numberArray.prototype.filter
Optional thisArg: anyArray.prototype.find
Optional thisArg: anyFind the Model(s) based on the given key(s).
Optional defaultVal: Ancestralised<T, CT>Optional defaultVal: ModelCollection<Ancestralised<T, CT>>Return the first element in the collection, if callback given the first element that passes the truth test. Otherwise, undefined.
Optional callback: ((item, index) => boolean)Array.prototype.flat
Array.prototype.flatMap
Optional thisArg: ThisReturn all the models in a single level with no children set.
Optional thisArg: any[]Assert whether there are duplicates in the collection.
Optional key: SimpleAttributeKeys<Ancestralised<T, CT>> | ((model) => U)Return only models that are both in the arguments and the collection.
Check that the collection the same as the given one.
Return the last element in the collection, if callback given the last element that passes the truth test. Otherwise, undefined.
Optional callback: ((item, index) => boolean)All the models that do not have any children.
Array.prototype.map
Optional thisArg: anyGet the primary keys of the models.
Only keep every nth element in the collection.
Only return the models with ids from the arguments.
Order the collection by given configurations(s)
Rest ...additional: Ancestralised<T, CT> extends Record<PropertyKey, any>Pad collection to the specified length with a value. Negative length will pad the beginning of the collection.
Optional value: Ancestralised<T, CT> | (() => Ancestralised<T, CT>)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: Ancestralised<T, CT>Array.prototype.reduceRight
Optional initialValue: Ancestralised<T, CT>Array.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.sort
Optional compareFn: ((a, b) => number)Array.prototype.splice
Rest ...items: Ancestralised<T, CT>[]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 this and the argument without overlapping models.
De-duplicate the collection. Optionally find duplicates by key or method on model. If key is undefined on the model, fall back to model check.
Optional key: string | ((model) => any)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 Protected _isProtected
Check whether the given argument is (probably) model or not.
Static Protected _isProtected
Determine if the given array is a Model array.
Static isAsserts whether the given value is an instance of AncestryCollection.
Static isAsserts whether the given value is an instance of Collection.
Static isAsserts whether the given value is an instance of ModelCollection.
Static timesCreate a new collection from the evaluated callback or value the given number of times.
Static treeArrange the items in an ancestry tree format.
The ModelCollection to sort.
The key that identifies the parent's id.
The key that will include descendants.
Generated using TypeDoc
The models already arranged in an ancestry tree format.