Utils

Miscellaneous utility classes.

Classes

Name Description  
AbandonedError  
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.  
StopWatch A StopWatch for timing operations.  
YieldManager Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.  

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.  
isProperSubclassOf Check if class subclass is a different class from superclass but extends from superclass  
isSubclassOf Check if class subclass is superclass or extends from superclass  
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.  
YieldManagerOptions Options supplied to a YieldManager.  

Type Aliases

Name Description  
AccessToken A string representing a token used to access resources.  
AsyncFunction Any function returning a Promise.  
AsyncMethodsOf Extracts the names of all function properties of T that return a Promise.  
Constructor Generically represents a class T, for use in type annotations.  
DisposeFunc A definition of function which may be called to dispose an object  
MarkRequired Make a new type from an existing type T, with set of optional properties K required.  
MaybePromise A type that is either T or Promise<T>.  
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 A function that returns a numerical value indicating how two objects are ordered in relation to one another.  
PickAsyncMethods The members of T that are async functions (functions that return a promise), and no other properties  
PickMethods The members of T that are functions and no other properties  
PickSyncMethods The members of T that are functions that do not return a Promise  
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: 06 November, 2024