collectype / Collection / Collection
Defined in: Collection.ts:21
Base collection implementation using a configurable functions class.
T
The type of items in the collection.
F extends BaseFunctions<T> = BaseFunctions<T>
The type of the functions class, must extend BaseFunctions
The functions class constructor must match the Constructor<F> type, i.e.,
it must accept an array of items as its only argument.
Example usage:
import { Collection, BaseFunctions, Constructor } from 'collectype';
const collection = new Collection<MyType, Constructor<BaseFunctions>>(items, BaseFunctions);
Collectable<T>new Collection<
T,F>(items,FunctionsClass):Collection<T,F>
Defined in: Collection.ts:34
Creates an instance of Collection.
T[]
Array of items.
Constructor<F>
The class constructor for chainable operations, must match Constructor
Collection<T, F>
protected_items:T[]
Defined in: Collection.ts:22
protected_functionsClass:Constructor<F>
Defined in: Collection.ts:27
The constructor for the functions class, typed as Constructor
get items():
T[]
Defined in: Collection.ts:43
Gets the array of items.
T[]
The current array of items.
get count():
number
Defined in: Collection.ts:51
Gets the number of items.
number
The count of items.
get fn():
F
Defined in: Collection.ts:59
Gets a new instance of the functions class with current items for chainable operations. The type reflects the actual class passed.
F