Utils

Miscellaneous utility classes.

Classes

Name Description  
AbandonedError Beta
BeDuration A duration of time.  
BeTimePoint A specific point in time relative to the current time.  
ByteStream Allows the contents of an ArrayBuffer  
DisposableList A disposable container of disposable objects.  
OneAtATimeAction Orchestrator of a one-at-a-time activity. Beta
StopWatch A StopWatch for timing operations.  

Global Functions

Name Description  
areEqualPossiblyUndefined Compare two possibly-undefined values for equality.  
asInstanceOf Cast obj to an instance of class T, or return undefined if obj is not an instance of class T.  
assert Asserts that a condition is true and - when enabled - throws an error if it is not.  
base64StringToUint8Array Given a base-64-encoded string, decode it into an array of bytes.  
compareBooleans  
compareBooleansOrUndefined  
compareNumbers  
compareNumbersOrUndefined  
comparePossiblyUndefined  
compareStrings  
compareStringsOrUndefined  
compareWithTolerance An OrderedComparator for numbers that treats two numbers as equal if the absolute value of their difference is less than a specified tolerance.  
dispose Convenience function for disposing of a disposable object that may be undefined.  
disposeArray Disposes of and empties a list of disposable objects.  
isIDisposable A type guard that checks whether the given argument implements IDisposable interface  
isInstanceOf Returns true if obj is an object of class T.  
omit A runtime property omitter, makes a shallow copy of the given object without the specified properties  
using A 'using' function which is a substitution for .NET's using statement.  
utf8ToString Given an array of bytes containing a utf-8 string, convert to a string.  

Interfaces

Name Description  
IDisposable Interface adopted by a type which has deterministic cleanup logic.  

Type Aliases

Name Description  
AccessToken A string representing a token used to access resources.  
AsyncFunction  
AsyncMethodsOf Extracts the names of all function properties of T that return a Promise.  
Constructor  
DisposeFunc  
MarkRequired Make a new type from an existing type T, with set of optional properties K required.  
Mutable The inverse of TypeScript's Readonly type, producing a type that has all the properties of T with any readonly modifiers removed.  
NonFunctionPropertiesOf Produces a type consisting of all of the public properties of T except for those of type function.  
NonFunctionPropertyNamesOf Extracts the names of all public properties of T that are not of type function.  
Optional Make a new type from an existing type T, with set of required properties K optional.  
OrderedComparator  
PickAsyncMethods The members of T that are async functions (functions that return a promise), and no other properties  
PromiseReturnType Extracts the type to which the Promise returned by an async function resolves.  
RequireAtLeastOne Defines a type wherein at least one of the properties of T is required to exist.  

Last Updated: 30 November, 2023