A collection of helpful utilities for Typescript projects.
Converts various types of arrays, strings and numbers to a buffer.
const stringBuffer = await BufferHelper.toBuffer('Hello World');
An extremely fast function for deep-cloning an object which only contains simple values, i.e. primitives, arrays and nested simple objects.
const foo = {
prop1: 'hello',
prop2: 'world',
}
const bar = CloneHelper.simpleDeepClone(foo);
console.assert(foo === bar);
A collection of general use guards such as.
- isObject
- isClassInstance
- notNullOrUndefined
- assertNever
Provides a .NetCore style Activator to instantiate generic types at runtime.
Methods to repeat functions multiple times.
FastFlatMap provides same result as FlatMap in the es2019 standard but 40% quicker.
const obj = {
boringProp: 123,
goodProp: 'abc',
nestedProp: {
boringProp: 456,
goodProb: 'def'
}
}
MapHelper.FastFlatMap(obj, 'goodProp');
this will result in
const result = [
{
goodProp: 'abc',
},
{
goodProp: 'def',
}
]
Assortment of number formatting functions.
Assortment of object functions for merging, flattening, serialising, sorting.
Helper to convert observables to promises.
Assortment of object functions for merging, flattening, serialising, sorting.
Assortment of helpers to detect types of TypedArrays as well as converting them to buffers