Defined in: collection.ts:7
Type
new Collection<Type>(items?: Type[]): Collection<Type>;Defined in: collection.ts:10
Type[]
Collection<Type>
add(data: Type): this;Defined in: collection.ts:38
Adds a new element to the end of the collection
Type
this
all(): Type[];Defined in: collection.ts:205
Returns the underlying array represented by the collection
Type[]
clone(): Collection<Type>;Defined in: collection.ts:198
Creates a shallow copy of collection
Collection<Type>
concat(collection: Collection<Type>): this;Defined in: collection.ts:128
Combines elements from both collections into one
Collection<Type>
this
count(): number;Defined in: collection.ts:78
Returns the number of items in the collection
number
filter(iterator: CollectionIterator): Collection<Type>;Defined in: collection.ts:107
Iterates over elements of collection, returning a collection of all elements that meets the requirements
Collection<Type>
find(iterator: CollectionIterator): Type;Defined in: collection.ts:33
Return the first element of the collection that meets the requirements
Type
first(iterator?: CollectionIterator): Type;Defined in: collection.ts:15
Gets the first element of collection
Type
forEach(callback: (item: Type, index?: number) => void | Promise<void>): this;Defined in: collection.ts:114
Iterates over elements of collection and invokes callback for each element
(item: Type, index?: number) => void | Promise<void>
this
groupBy(iterator: CollectionIterator): Dictionary<Type[]>;Defined in: collection.ts:184
Creates a Dictionary composed of keys generated from the results of running each element of collection thru iterator
Dictionary<Type[]>
includes(value: CollectionIterator): boolean;Defined in: collection.ts:167
Checks if value is in collection
boolean
indexOf(item: Type): number;Defined in: collection.ts:88
Gets the index at which the first occurrence of value is found in collection
Type
number
intersects(collection: Collection<Type>): Collection<Type>;Defined in: collection.ts:50
Returns a new collection with all unique elements that are in both collections
Collection<Type>
Collection<Type>
intersectsBy(collection: Collection<Type>, iterator: string | CollectionIterator): Collection<Type>;Defined in: collection.ts:59
Returns a new collection with all unique elements that are in both collections, taking into account the specified requirements
Collection<Type>
string | CollectionIterator
Collection<Type>
isEmpty(): boolean;Defined in: collection.ts:137
Returns true if the collection is empty
boolean
isNotEmpty(): boolean;Defined in: collection.ts:142
Returns true if the collection is not empty
boolean
join(separator: string): string;Defined in: collection.ts:83
Converts all elements in collection into a string separated by separator
string
string
keyBy(iterator: CollectionIterator): Dictionary<Type>;Defined in: collection.ts:177
Creates a Dictionary composed of keys generated from the results of running each element of collection thru iterator
Dictionary<Type>
last(predicate?: CollectionIterator): Type;Defined in: collection.ts:24
Gets the last element of collection
Type
map<Type>(iterator: (item: any) => Type): Collection<Type>;Defined in: collection.ts:191
Creates a new Collection of values by running each element in collection thru iterator
Type
(item: any) => Type
Collection<Type>
missing(value: CollectionIterator): boolean;Defined in: collection.ts:172
Checks whether a value is missing from the collection
boolean
remove(iterator: CollectionIterator): Collection<Type>;Defined in: collection.ts:121
Removes all elements from collection that meets the requirements
Collection<Type>
sample(): Type;Defined in: collection.ts:45
Gets a random element from collection
Type
slice(start?: number, end?: number): Collection<Type>;Defined in: collection.ts:71
Creates a slice of collection from start up to, but not including, end
number
number
Collection<Type>
sort(): Collection<Type>;Defined in: collection.ts:147
Sorts the items in the collection alphabetically
Collection<Type>
sortBy(
iterators:
| CollectionIterator
| CollectionIterator[],
orders: string[] | "desc" | "asc",
natural: boolean): this;Defined in: collection.ts:154
Sorts collection items according to requirements
CollectionIterator | CollectionIterator[]
string[] | "desc" | "asc"
boolean = true
this
toJSON(): string;Defined in: collection.ts:210
Converts the collection into a JSON serialized string
string
uniq(): Collection<Type>;Defined in: collection.ts:93
Creates a duplicate-free version of a collection
Collection<Type>
uniqBy(iterator: CollectionIterator): Collection<Type>;Defined in: collection.ts:100
Creates a duplicate-free version of a collection according to requirements
Collection<Type>