Skip to main content

Module: utilities/src

Classes

Interfaces

References

filterNullish

Renames and re-exports filterNullAndUndefined


filterNullishAndEmpty

Renames and re-exports filterNullAndUndefinedAndEmpty


filterNullishAndZero

Renames and re-exports filterNullAndUndefinedAndZero


filterNullishOrEmpty

Renames and re-exports filterNullAndUndefinedAndEmpty


filterNullishOrZero

Renames and re-exports filterNullAndUndefinedAndZero


isNullish

Renames and re-exports isNullOrUndefined


isNullishOrEmpty

Renames and re-exports isNullOrUndefinedOrEmpty


isNullishOrZero

Renames and re-exports isNullOrUndefinedOrZero


parseURL

Renames and re-exports tryParseURL


tryParse

Renames and re-exports tryParseJSON

Type Aliases

AbstractConstructor

Ƭ AbstractConstructor<T>: (...args: any[]) => T

Type parameters

Name
T

Type declaration

• (...args)

Parameters
NameType
...argsany[]

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:64


AbstractCtor

Ƭ AbstractCtor<A, R>: (...args: A) => R

Type parameters

NameType
Aextends Arr = readonly any[]
Rany

Type declaration

• (...args)

Parameters
NameType
...argsA

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:54


AnyObject

Ƭ AnyObject<T>: { [K in keyof T]: T[K] }

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:106


ArgumentTypes

Ƭ ArgumentTypes<F>: F extends (...args: infer A) => any ? A : never

Type parameters

NameType
Fextends (...args: any[]) => unknown

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:38


Arr

Ƭ Private Arr: readonly any[]

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:44


ArrayElementType

Ƭ ArrayElementType<T>: T extends infer K[] ? K : T extends readonly infer RK[] ? RK : T

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:186


Awaitable

Ƭ Awaitable<T>: PromiseLike<T> | T

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:79


Builtin

Ƭ Builtin: Primitive | Function | Date | Error | RegExp

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:4


Constructor

Ƭ Constructor<T>: (...args: any[]) => T

Type parameters

Name
T

Type declaration

• (...args)

Parameters
NameType
...argsany[]

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:59


Ctor

Ƭ Ctor<A, R>: (...args: A) => R

Type parameters

NameType
Aextends Arr = readonly any[]
Rany

Type declaration

• (...args)

Parameters
NameType
...argsA

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:49


DeepPartial

Ƭ DeepPartial<T>: { [P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial<U>[] : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]> }

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:30


DeepRequired

Ƭ DeepRequired<T>: T extends Builtin ? NonNullable<T> : T extends Map<infer K, infer V> ? Map<DeepRequired<K>, DeepRequired<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepRequired<K>, DeepRequired<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepRequired<K>, DeepRequired<V>> : T extends Set<infer U> ? Set<DeepRequired<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepRequired<U>> : T extends WeakSet<infer U> ? WeakSet<DeepRequired<U>> : T extends Promise<infer U> ? Promise<DeepRequired<U>> : T extends {} ? { [K in keyof T]-?: DeepRequired<T[K]> } : NonNullable<T>

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:6


FirstArgument

Ƭ FirstArgument<T>: T extends (arg1: infer U, ...args: unknown[]) => unknown ? U : unknown

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:69


Mutable

Ƭ Mutable<T>: { -readonly [P in keyof T]: T[P] extends unknown[] | NonNullObject ? Mutable<T[P]> : T[P] }

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:149


NonNullObject

Ƭ NonNullObject: {} & object

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:98


NonNullableProperties

Ƭ NonNullableProperties<T>: { [P in keyof T]: NonNullable<T[P]> }

Type parameters

NameType
Tunknown

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:90


Nullish

Ƭ Nullish: null | undefined

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:84


PartialRequired

Ƭ PartialRequired<T, K>: Partial<Omit<T, K>> & Required<Pick<T, K>>

Type parameters

NameType
TT
Kextends keyof T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:28


PickByValue

Ƭ PickByValue<T, V>: { [P in keyof T]: T[P] extends V ? P : never }[keyof T] & keyof T

Type parameters

Name
T
V

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:127


Primitive

Ƭ Primitive: string | number | boolean | bigint | symbol | undefined | null

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:1


RequiredExcept

Ƭ RequiredExcept<T, K>: Partial<Pick<T, K>> & Required<Omit<T, K>>

Type parameters

NameType
TT
Kextends keyof T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:26


SecondArgument

Ƭ SecondArgument<T>: T extends (arg1: unknown, arg2: infer U, ...args: unknown[]) => unknown ? U : unknown

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:74


StrictRequired

Ƭ StrictRequired<T>: { [P in keyof T]-?: NonNullable<T[P]> }

Type parameters

Name
T

Defined in

projects/utilities/packages/utilities/src/lib/types.ts:172


ThrottleFn

Ƭ ThrottleFn<T>: T & { flush: () => void }

Type parameters

NameType
Textends (...args: any[]) => any

Defined in

projects/utilities/packages/utilities/src/lib/throttle.ts:1

Functions

arrayStrictEquals

arrayStrictEquals<T>(arr1, arr2): boolean

Type parameters

NameType
Textends readonly unknown[]

Parameters

NameTypeDescription
arr1T
arr2T

Returns

boolean

Defined in

projects/utilities/packages/utilities/src/lib/arrayStrictEquals.ts:6


cast

cast<T>(value): T

Type parameters

Name
T

Parameters

NameTypeDescription
valueunknown

Returns

T

Defined in

projects/utilities/packages/utilities/src/lib/cast.ts:10


chunk

chunk<T>(array, chunkSize): T[][]

Type parameters

Name
T

Parameters

NameTypeDescription
arrayreadonly T[]
chunkSizenumber

Returns

T[][]

Defined in

projects/utilities/packages/utilities/src/lib/chunk.ts:6


classExtends

classExtends<T>(value, base): value is T

Type parameters

NameType
Textends Ctor<readonly any[], any>

Parameters

NameTypeDescription
valueCtor<readonly any[], any>
baseT

Returns

value is T

Defined in

projects/utilities/packages/utilities/src/lib/classExtends.ts:8


codeBlock

codeBlock<C>(content): ```` ${C} ````

Type parameters

NameType
Cextends string

Parameters

NameTypeDescription
contentC

Returns

```` ${C} ````

Defined in

projects/utilities/packages/utilities/src/lib/codeBlock.ts:14

codeBlock<L, C>(language, content): ````${L} ${C} ````

Type parameters

NameType
Lextends string
Cextends string

Parameters

NameTypeDescription
languageL
contentC

Returns

````${L} ${C} ````

Defined in

projects/utilities/packages/utilities/src/lib/codeBlock.ts:28


cutText

cutText(str, length): string

Parameters

NameTypeDescription
strstring
lengthnumber

Returns

string

Defined in

projects/utilities/packages/utilities/src/lib/cutText.ts:10


debounce

debounce<FnArgumentsType, FnReturnType>(func, options?): DebouncedFunc<FnArgumentsType, FnReturnType>

Type parameters

NameType
FnArgumentsTypeextends any[]
FnReturnTypeFnReturnType

Parameters

NameTypeDescription
func(...args: FnArgumentsType) => FnReturnType
optionsDebounceSettings

Returns

DebouncedFunc<FnArgumentsType, FnReturnType>

Defined in

projects/utilities/packages/utilities/src/lib/debounce/debounce.ts:68


deepClone

deepClone<T>(source): T

Type parameters

Name
T

Parameters

NameTypeDescription
sourceT

Returns

T

Defined in

projects/utilities/packages/utilities/src/lib/deepClone.ts:7


filterNullAndUndefined

filterNullAndUndefined<TValue>(value): value is TValue

Type parameters

Name
TValue

Parameters

NameTypeDescription
valueNullish | TValue

Returns

value is TValue

Defined in

projects/utilities/packages/utilities/src/lib/filterNullAndUndefined.ts:19


filterNullAndUndefinedAndEmpty

filterNullAndUndefinedAndEmpty<TValue>(value): value is TValue

Type parameters

Name
TValue

Parameters

NameTypeDescription
value"" | Nullish | TValue

Returns

value is TValue

Defined in

projects/utilities/packages/utilities/src/lib/filterNullAndUndefinedAndEmpty.ts:19


filterNullAndUndefinedAndZero

filterNullAndUndefinedAndZero<TValue>(value): value is TValue

Type parameters

Name
TValue

Parameters

NameTypeDescription
value0 | Nullish | TValue

Returns

value is TValue

Defined in

projects/utilities/packages/utilities/src/lib/filterNullAndUndefinedAndZero.ts:19


getDeepObjectKeys

getDeepObjectKeys<T>(obj, options?): string[]

Type parameters

Name
T

Parameters

NameTypeDescription
objAnyObject<T>
options?GetDeepObjectKeysOptions

Returns

string[]

Defined in

projects/utilities/packages/utilities/src/lib/getDeepObjectKeys.ts:15


hasAtLeastOneKeyInMap

hasAtLeastOneKeyInMap<T>(map, keys): boolean

Type parameters

Name
T

Parameters

NameTypeDescription
mapReadonlyMap<T, any>
keysreadonly T[]

Returns

boolean

Defined in

projects/utilities/packages/utilities/src/lib/hasAtLeastOneKeyInMap.ts:7


inlineCodeBlock

inlineCodeBlock<C>(content): ``${C}``

Type parameters

NameType
Cextends string

Parameters

NameTypeDescription
contentC

Returns

``${C}``

Defined in

projects/utilities/packages/utilities/src/lib/inlineCodeBlock.ts:7


isClass

isClass(input): input is Ctor<readonly any[], any>

Parameters

NameTypeDescription
inputunknown

Returns

input is Ctor<readonly any[], any>

Defined in

projects/utilities/packages/utilities/src/lib/isClass.ts:7


isFunction

isFunction(input): input is Function

Parameters

NameTypeDescription
inputunknown

Returns

input is Function

Defined in

projects/utilities/packages/utilities/src/lib/isFunction.ts:6


isNullOrUndefined

isNullOrUndefined(value): value is Nullish

Parameters

NameTypeDescription
valueunknown

Returns

value is Nullish

Defined in

projects/utilities/packages/utilities/src/lib/isNullOrUndefined.ts:7


isNullOrUndefinedOrEmpty

isNullOrUndefinedOrEmpty(value): value is "" | Nullish

Parameters

NameTypeDescription
valueunknown

Returns

value is "" | Nullish

Defined in

projects/utilities/packages/utilities/src/lib/isNullOrUndefinedOrEmpty.ts:8


isNullOrUndefinedOrZero

isNullOrUndefinedOrZero(value): value is 0 | Nullish

Parameters

NameTypeDescription
valueunknown

Returns

value is 0 | Nullish

Defined in

projects/utilities/packages/utilities/src/lib/isNullOrUndefinedOrZero.ts:8


isNumber

isNumber(input): input is number

Parameters

NameTypeDescription
inputunknown

Returns

input is number

Defined in

projects/utilities/packages/utilities/src/lib/isNumber.ts:5


isObject

isObject(input, constructorType?): input is object

Parameters

NameTypeDescription
inputunknown
constructorType?ObjectConstructor

Returns

input is object

Defined in

projects/utilities/packages/utilities/src/lib/isObject.ts:8

isObject<T>(input, constructorType): input is InstanceType<T>

Type parameters

NameType
Textends Constructor<unknown>

Parameters

NameType
inputunknown
constructorTypeT

Returns

input is InstanceType<T>

Defined in

projects/utilities/packages/utilities/src/lib/isObject.ts:9


isPrimitive

isPrimitive(input): input is string | number | bigint | boolean

Parameters

NameTypeDescription
inputunknown

Returns

input is string | number | bigint | boolean

Defined in

projects/utilities/packages/utilities/src/lib/isPrimitive.ts:7


isThenable

isThenable(input): input is Thenable

Parameters

NameTypeDescription
inputunknown

Returns

input is Thenable

Defined in

projects/utilities/packages/utilities/src/lib/isThenable.ts:21


lazy

lazy<T>(cb): () => T

Type parameters

Name
T

Parameters

NameTypeDescription
cb() => T

Returns

fn

▸ (): T

Returns

T

Defined in

projects/utilities/packages/utilities/src/lib/lazy.ts:6


makeObject

makeObject(path, value, obj?): Record<string, unknown>

Parameters

NameTypeDescription
pathstring
valueunknown
objRecord<string, unknown>

Returns

Record<string, unknown>

Defined in

projects/utilities/packages/utilities/src/lib/makeObject.ts:7


mergeDefault

mergeDefault<A, B>(base, overwrites?): DeepRequired<A & B>

Type parameters

NameType
Aextends object
Bextends Partial<A>

Parameters

NameTypeDescription
baseA
overwrites?B

Returns

DeepRequired<A & B>

Defined in

projects/utilities/packages/utilities/src/lib/mergeDefault.ts:43


mergeObjects

mergeObjects<A, B>(objTarget, objSource): A & B

Type parameters

NameType
Aextends object
Bextends object

Parameters

NameTypeDescription
objTargetA
objSourceReadonly<B>

Returns

A & B

Defined in

projects/utilities/packages/utilities/src/lib/mergeObjects.ts:8


noop

noop(): void

Returns

void

Defined in

projects/utilities/packages/utilities/src/lib/noop.ts:2


objectEntries

objectEntries<T>(obj): T extends ArrayLike<any> ? [`${number}`, T[number]][] : [keyof T, T[keyof T]][]

Type parameters

NameType
Textends object

Parameters

NameType
objT

Returns

T extends ArrayLike<any> ? [`${number}`, T[number]][] : [keyof T, T[keyof T]][]

Defined in

projects/utilities/packages/utilities/src/lib/objectEntries.ts:3


objectKeys

objectKeys<T>(obj): T extends ArrayLike<any> ? `${number}`[] : keyof T[]

Type parameters

NameType
Textends object

Parameters

NameType
objT

Returns

T extends ArrayLike<any> ? `${number}`[] : keyof T[]

Defined in

projects/utilities/packages/utilities/src/lib/objectKeys.ts:3


objectToTuples

objectToTuples<T>(obj, prefix?): [keyof T, T[keyof T]][]

Type parameters

Name
T

Parameters

NameTypeDefault valueDescription
objAnyObject<T>undefined
prefixstring''

Returns

[keyof T, T[keyof T]][]

Defined in

projects/utilities/packages/utilities/src/lib/objectToTuples.ts:9


objectValues

objectValues<T>(obj): T extends ArrayLike<any> ? T[number][] : T[keyof T][]

Type parameters

NameType
Textends object

Parameters

NameType
objT

Returns

T extends ArrayLike<any> ? T[number][] : T[keyof T][]

Defined in

projects/utilities/packages/utilities/src/lib/objectValues.ts:3


partition

partition<T>(array, predicate): T[][]

Type parameters

Name
T

Parameters

NameTypeDescription
arrayT[]
predicate(value: T, index: number) => boolean

Returns

T[][]

Defined in

projects/utilities/packages/utilities/src/lib/partition.ts:12


pickRandom

pickRandom<T>(array, amount?): T

Type parameters

Name
T

Parameters

NameTypeDescription
arrayreadonly T[]
amount?1

Returns

T

Defined in

projects/utilities/packages/utilities/src/lib/pickRandom.ts:6

pickRandom<T>(array, amount): T[]

Type parameters

Name
T

Parameters

NameType
arrayreadonly T[]
amountnumber

Returns

T[]

Defined in

projects/utilities/packages/utilities/src/lib/pickRandom.ts:7


range

range(min, max, step): number[]

Parameters

NameTypeDescription
minnumber
maxnumber
stepnumber

Returns

number[]

Defined in

projects/utilities/packages/utilities/src/lib/range.ts:7


regExpEsc

regExpEsc(str): string

Parameters

NameTypeDescription
strstring

Returns

string

Defined in

projects/utilities/packages/utilities/src/lib/regExpEsc.ts:7


roundNumber

roundNumber(num, scale?): number

Parameters

NameTypeDefault valueDescription
numstring | numberundefined
scalenumber0

Returns

number

Defined in

projects/utilities/packages/utilities/src/lib/roundNumber.ts:7


sleep

sleep<T>(ms, value?, options?): Promise<T>

Type parameters

NameType
Tundefined

Parameters

NameTypeDescription
msnumber
value?T
options?SleepOptions-

Returns

Promise<T>

Defined in

projects/utilities/packages/utilities/src/lib/sleep.ts:35


sleepSync

sleepSync<T>(ms, value?): T

Type parameters

NameType
Tundefined

Parameters

NameTypeDescription
msnumber
value?T

Returns

T

Defined in

projects/utilities/packages/utilities/src/lib/sleep.ts:64


splitText

splitText(str, length, char?): string

Parameters

NameTypeDefault valueDescription
strstringundefined
lengthnumberundefined
charstring' '

Returns

string

Defined in

projects/utilities/packages/utilities/src/lib/splitText.ts:9


throttle

throttle<T>(func, wait): ThrottleFn<T>

Type parameters

NameType
Textends (...args: any[]) => any

Parameters

NameTypeDescription
funcT
waitnumber

Returns

ThrottleFn<T>

Defined in

projects/utilities/packages/utilities/src/lib/throttle.ts:13


toTitleCase

toTitleCase(str, options?): string

Parameters

NameTypeDescription
strstring
optionsToTitleCaseOptions

Returns

string

Defined in

projects/utilities/packages/utilities/src/lib/toTitleCase.ts:35


tryParseJSON

tryParseJSON(value): object | string | number

Parameters

NameTypeDescription
valuestring

Returns

object | string | number

Defined in

projects/utilities/packages/utilities/src/lib/tryParseJSON.ts:5


tryParseURL

tryParseURL(value): URL | null

Parameters

NameTypeDescription
valuestring

Returns

URL | null

Defined in

projects/utilities/packages/utilities/src/lib/tryParseURL.ts:6