Helper types and functions.
mutable(Object.freeze({ a: 0 })); // {a:0}mutable('a'); // 'a'
// observable = -null-undefined-0-1-2-observable.pipe(filterNil()).subscribe(); // -----0-1-2-
const error = new Error('a');asError(error); // new Error('a')asError('a'); // new Error('a')
asString({ a: 0 }); // '{"a":0}'asString({ a: () => ({ a: 0 }) }); // '{"a":"() => ({ a: 0 })"}'asString([0, 'a', null, true]); // '[0,"a",null,true]'asString([{ a: 0 }]); // '[{"a":0}]'
delayedPromise('a', 10); // Promise resolves 'a' after 10ms
Executes an assertion if the value is not nil. If the value is nil returns true.
ifDefined(value?.id, typeof value?.id === 'string');
Generated using TypeDoc
Environment Helpers
Use cases
Table of Contents
mutable()
filterNil()
asError()
asString()
delayedPromise()
ifDefined()
Executes an assertion if the value is not nil. If the value is nil returns true.