projects/m2-core/src/lib/core/utils/array.utils.ts
Methods |
|
| Static arrayToMap | ||||||||||||
arrayToMap(array: T[], property)
|
||||||||||||
Type parameters :
|
||||||||||||
|
Parameters :
Returns :
Map<any, T>
|
| Static arrayToMapExt |
arrayToMapExt(array: I[], keyMapper: (item: I) => void, valueMapper: (item: I) => void)
|
Type parameters :
|
|
Returns :
Map<K, V>
|
| Static arrayToMapFnKeyMapper | |||||||||
arrayToMapFnKeyMapper(array: V[], keyMapper: (item: V) => void)
|
|||||||||
Type parameters :
|
|||||||||
|
Parameters :
Returns :
Map<K, V>
|
| Static createIntArray |
createIntArray(from: number, to: number)
|
|
Creates sequential array of integers within the specified borders according to the following schema: [from; to) {Array}
Returns :
number[]
|
| Static diffArrays | ||||||||||||
diffArrays(arr1: T[], arr2: T[], getKeyFn?: (item?: T) => void)
|
||||||||||||
Type parameters :
|
||||||||||||
|
Method assumes that arrays contain unique items in terms of getKeyFn (item => item by default).
Parameters :
Returns :
literal type
|
| Static equalContent | ||||||||||||
equalContent(a1: T[], a2: T[], equalsFn?: (i1?: T,i2?: T) => void)
|
||||||||||||
Type parameters :
|
||||||||||||
|
Parameters :
Returns :
boolean
|
| Static find | |||||||||
find(arr: T[], predicate: (item: T) => void)
|
|||||||||
Type parameters :
|
|||||||||
|
Parameters :
Returns :
ArrayElement<T>
|
| Static findDominant | ||||||
findDominant(values: T[])
|
||||||
Type parameters :
|
||||||
|
Parameters :
Returns :
T
|
| Static findFromEnd | |||||||||
findFromEnd(arr: T[], predicate: (item: T) => void)
|
|||||||||
Type parameters :
|
|||||||||
|
Parameters :
Returns :
T
|
| Static findOrAdd | ||||||||||||||||||||
findOrAdd(arr: T[], target: T, prop: string, toTheBeginnng)
|
||||||||||||||||||||
Type parameters :
|
||||||||||||||||||||
|
Joins arrays, filters out duplicates and sets 'partiallyApplied' field
Parameters :
Returns :
T
|
| Static getChunks | |||||||||
getChunks(arr: T[], chunkSize: number)
|
|||||||||
Type parameters :
|
|||||||||
|
Parameters :
Returns :
[][]
|
| Static getLast | ||||||
getLast(arr: T[])
|
||||||
Type parameters :
|
||||||
|
Parameters :
Returns :
T
|
| Static getUnique | ||||||
getUnique(a: T[])
|
||||||
Type parameters :
|
||||||
|
Parameters :
Returns :
T[]
|
| Static getUniqueKeys | |||||||||
getUniqueKeys(arr: T[], keyMapper: (item: T) => void)
|
|||||||||
Type parameters :
|
|||||||||
|
Parameters :
Returns :
K[]
|
| Static groupBy | |||||||||||||||
groupBy(array: T[], keyMapper: (item: T) => void, valueMapper?: (item?: T) => void, filterFn?: (item?: T) => void)
|
|||||||||||||||
Type parameters :
|
|||||||||||||||
|
Parameters :
Returns :
Map<K, V[]>
|
| Static groupToStringMap |
groupToStringMap(array: T[], keyMapper: (item: T) => void, valueMapper?: (item?: T) => void)
|
Type parameters :
|
|
Returns :
StringMap<V[]>
|
| Static isEmpty | ||||||
isEmpty(array: Array
|
||||||
|
Parameters :
Returns :
boolean
|
| Static joinArrays | |||||||||
joinArrays(arrays: T[][], separator?: S)
|
|||||||||
Type parameters :
|
|||||||||
|
Parameters :
Returns :
Array<T | S>
|
| Static pickElementByName |
pickElementByName(array: V[], name: string, seed: number)
|
Type parameters :
|
|
Returns :
V
|
| Static remove | ||||||||||||||||
remove(array: T[], predicate: (item: T,index: number) => void, firstOnly)
|
||||||||||||||||
Type parameters :
|
||||||||||||||||
|
Removes elements from the array that satisfy the predicate. {T[]} Array of removed elements.
Parameters :
Returns :
T[]
|
| Static sort | ||||||||||||||||
sort(list: Array
|
||||||||||||||||
|
Parameters :
Returns :
void
|
| Static sortCriteria | ||||||
sortCriteria(criteria: Option[])
|
||||||
|
Pushes "name" criteria to top
Parameters :
Returns :
void
|
| Static toArray | ||||||
toArray(elem: T | T[])
|
||||||
Type parameters :
|
||||||
|
Parameters :
Returns :
T[]
|