Class HashArrayUtil
Index
Constructors
Methods
Constructors
constructor
- new
Hash (): HashArrayUtilArray Util Returns HashArrayUtil
Methods
Staticaverage
- average<T>(source, key, index, weightKey?): number
Iterates deeply over items specified by
keyandindexwith an optionalweightKeyand calculates the average value.Type Parameters
Parameters
Returns number
The average value for the given iteration.
Staticdifference
- difference<T>(source, target, output?): HashArray<T>
Returns the difference of this HashArray and a target HashArray. If no output HashArray is provided the source is cloned.
Type Parameters
Parameters
Returns HashArray<T>
Returns a new HashArray that contains the difference between source (A) and target (B) HashArrays. Returns A - B.
Staticsample
Staticsum
- sum<T>(source, key, index, weightKey?): number
Iterates deeply over items specified by
keyandindexwith an optionalweightKeyand calculates the sum.Type Parameters
Parameters
Returns number
The sum for the given iteration.
Provides extra examples of how various additional operations can be added on top of HashArray. These operations are not included with HashArray to keep it lean and mean for TrieSearch. By all means though extend HashArray and add the operations that you need.
There are tests for all operations below in
./test/hash/HAExtra.test.ts.