npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ti-platform/aide

v3.8.1

Published

This package exposes some types and functions as utilities that can be used by other packages. Refer to the below API Docs for more information.

Readme

@ti-platform/aide

This package exposes some types and functions as utilities that can be used by other packages. Refer to the below API Docs for more information.

Contents

API Docs

Classes

AbsentOptional<T>

Defined in: packages/aide/src/optional.ts:78

Wrapper around values that are either present or absent (null or undefined).

Type Parameters

| Type Parameter | | -------------- | | T |

Implements

Constructors

Constructor

new AbsentOptional<T>(): AbsentOptional<T>

Returns

AbsentOptional<T>

Methods

filter()

filter(predicate): Optional<T>

Defined in: packages/aide/src/optional.ts:79

If a value is present and the value matches the given predicate, return an Optional describing the value, otherwise return an empty Optional.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------- | | predicate | Predicate<NonNullable<T>> |

Returns

Optional<T>

Implementation of

Optional.filter

flatMap()

flatMap<R>(mapper): Optional<R>

Defined in: packages/aide/src/optional.ts:83

If a value is present, apply the provided Optional-bearing mapping function to it, return that result, otherwise return an empty Optional. This method is similar to map, but the provided mapper is one whose result is already an Optional, and if invoked, flatMap does not wrap it with an additional Optional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | --------------------------------------------------------------------- | | mapper | Mapper<NonNullable<T>, Optional<R>> |

Returns

Optional<R>

Implementation of

Optional.flatMap

getOrThrow()

getOrThrow(): NonNullable<T>

Defined in: packages/aide/src/optional.ts:87

If the value is present, returns the value, otherwise throws an Error.

Returns

NonNullable<T>

Implementation of

Optional.getOrThrow

ifAbsent()

ifAbsent(handler): this

Defined in: packages/aide/src/optional.ts:91

If the value is absent, invoke the specified handler, otherwise do nothing.

Parameters

| Parameter | Type | | --------- | ----------------------- | | handler | Runnable |

Returns

this

Implementation of

Optional.ifAbsent

ifPresent()

ifPresent(consumer): this

Defined in: packages/aide/src/optional.ts:96

If a value is present, invoke the specified consumer with the value, otherwise do nothing.

Parameters

| Parameter | Type | | ---------- | ------------------------------------------- | | consumer | Consumer<NonNullable<T>> |

Returns

this

Implementation of

Optional.ifPresent

isAbsent()

isAbsent(): this is AbsentOptional<T>

Defined in: packages/aide/src/optional.ts:100

If a value is absent (null or undefined), returns true, otherwise false.

Returns

this is AbsentOptional<T>

Implementation of

Optional.isAbsent

isPresent()

isPresent(): this is PresentOptional<T>

Defined in: packages/aide/src/optional.ts:104

If a value is present, returns true, otherwise false.

Returns

this is PresentOptional<T>

Implementation of

Optional.isPresent

map()

map<R>(mapper): Optional<R>

Defined in: packages/aide/src/optional.ts:108

If a value is present, apply the provided mapping function to it, and if the result is present, return an Optional describing the result, otherwise, return an empty Optional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | -------------------------------------------- | | mapper | Mapper<NonNullable<T>, R> |

Returns

Optional<R>

Implementation of

Optional.map

or()

or(other): Optional<T>

Defined in: packages/aide/src/optional.ts:112

If a value is present, returns an Optional describing the value, otherwise returns an Optional produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ----------------------------------------------------- | | other | Supplier<Optional<T>> |

Returns

Optional<T>

Implementation of

Optional.or

orElse()

orElse(other): T

Defined in: packages/aide/src/optional.ts:116

If a value is present, returns the value, otherwise returns other.

Parameters

| Parameter | Type | | --------- | ---- | | other | T |

Returns

T

Implementation of

Optional.orElse

orElseGet()

orElseGet(other): T

Defined in: packages/aide/src/optional.ts:120

If a value is present, returns the value, otherwise returns the result produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ---------------------------- | | other | Supplier<T> |

Returns

T

Implementation of

Optional.orElseGet

orElseThrow()

orElseThrow<X>(other): T

Defined in: packages/aide/src/optional.ts:124

If a value is present, returns the value, otherwise throws an exception to be created by the provided supplier.

Type Parameters

| Type Parameter | | -------------- | | X |

Parameters

| Parameter | Type | | --------- | ---------------------------- | | other | Supplier<X> |

Returns

T

Implementation of

Optional.orElseThrow

orUndefined()

orUndefined(): undefined

Defined in: packages/aide/src/optional.ts:128

If a value is present, returns the value, otherwise return undefined.

Returns

undefined

Implementation of

Optional.orUndefined


Deferred<T>

Defined in: packages/aide/src/promises.ts:15

Extracting out a Promise's resolve and reject method to allow one to more easily pass around those methods.

Type Parameters

| Type Parameter | Default type | Description | | -------------- | ------------ | ------------------------- | | T | void | The type to resolve with. |

Constructors

Constructor

new Deferred<T>(): Deferred<T>

Defined in: packages/aide/src/promises.ts:37

Create a new instance.

Returns

Deferred<T>

Properties

| Property | Modifier | Type | Description | | ------------------------------ | ---------- | --------------------- | ------------------------------ | | promise | readonly | Promise<T> | The underlying promise. | | reject | public | (reason?) => void | Reject the internal promise. | | resolve | public | (value) => void | Resolves the internal promise. |


MapPlus<K, V>

Defined in: packages/aide/src/map.ts:50

Extension to a Map with some new methods.

Extends

  • Map<K, V>

Type Parameters

| Type Parameter | | ----------------------------------------- | | K extends MapPlusKey | | V |

Constructors

Constructor

new MapPlus<K, V>(entries?): MapPlus<K, V>

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:50

Parameters

| Parameter | Type | | ---------- | ------------------------------------------ | | entries? | null | readonly readonly [K, V][] |

Returns

MapPlus<K, V>

Inherited from

Map<K, V>.constructor

Constructor

new MapPlus<K, V>(iterable?): MapPlus<K, V>

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:49

Parameters

| Parameter | Type | | ----------- | --------------------------------------------------------- | | iterable? | null | Iterable<readonly [K, V], any, any> |

Returns

MapPlus<K, V>

Inherited from

Map<K, V>.constructor

Properties

| Property | Modifier | Type | Inherited from | | ---------------------------------------- | ---------- | ---------------- | ------------------- | | [toStringTag] | readonly | string | Map.[toStringTag] | | size | readonly | number | Map.size | | [species] | readonly | MapConstructor | Map.[species] |

Methods

[iterator]()

[iterator](): MapIterator<[K, V]>

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:143

Returns an iterable of entries in the map.

Returns

MapIterator<[K, V]>

Inherited from

Map.[iterator]

asOptional()

asOptional(key): Optional<V>

Defined in: packages/aide/src/map.ts:54

Retrieve the value for the provided key as an Optional.

Parameters

| Parameter | Type | | --------- | ---- | | key | K |

Returns

Optional<V>

clear()

clear(): void

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:20

Returns

void

Inherited from

Map.clear

clearAndReturn()

clearAndReturn(): this

Defined in: packages/aide/src/map.ts:61

Same as Map#clear but returns this instance after clearing.

Returns

this

compute()

compute(key, remapper): Optional<V>

Defined in: packages/aide/src/map.ts:73

Attempts to compute a mapping for the specified key and its current mapped value, or undefined if there is no current mapping. If the remapping function returns undefined or null, the mapping is removed (or remains absent if initially absent).

Parameters

| Parameter | Type | | ---------- | --------------------------------------------------------------------------------------------------------------------------------------- | | key | K | | remapper | Mapper<{ key: K; map: MapPlus<K, V>; value: undefined | V; }, Optional<V>> |

Returns

Optional<V>

An optional containing the value associated with the provided key.

computeIfAbsent()

computeIfAbsent(key, mapper): Optional<V>

Defined in: packages/aide/src/map.ts:87

If the value for the specified key is absent, attempts to compute its value using the given mapping function and enters it into this map unless undefined or null.

Parameters

| Parameter | Type | | --------- | ---------------------------------------------------------------------------------------------------------- | | key | K | | mapper | Mapper<{ key: K; map: MapPlus<K, V>; }, Optional<V>> |

Returns

Optional<V>

An optional containing the value associated with the provided key.

computeIfPresent()

computeIfPresent(key, remapper): Optional<V>

Defined in: packages/aide/src/map.ts:104

If the value for the specified key is present, attempts to compute a new mapping given the key and its current mapped value. If the remapping function returns undefined or null, the mapping is removed.

Parameters

| Parameter | Type | | ---------- | --------------------------------------------------------------------------------------------------------------------------------------- | | key | K | | remapper | Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, Optional<V>> |

Returns

Optional<V>

An optional containing the value associated with the provided key.

contains()

contains(item): boolean

Defined in: packages/aide/src/map.ts:115

Returns true if this map maps one or more keys to the specified value.

Parameters

| Parameter | Type | | --------- | ---- | | item | V |

Returns

boolean

delete()

delete(key): boolean

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:24

Parameters

| Parameter | Type | | --------- | ---- | | key | K |

Returns

boolean

true if an element in the Map existed and has been removed, or false if the element does not exist.

Inherited from

Map.delete

each()

each(consumer): this

Defined in: packages/aide/src/map.ts:122

Similar to Map#forEach except return this at the end and the consumer retrieves the data differently.

Parameters

| Parameter | Type | | ---------- | ------------------------------------------------------------------------------------------------------------- | | consumer | Consumer<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }> |

Returns

this

entries()

entries(): MapIterator<[K, V]>

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:148

Returns an iterable of key, value pairs for every entry in the map.

Returns

MapIterator<[K, V]>

Inherited from

Map.entries

entriesAsArray()

entriesAsArray(): [K, V][]

Defined in: packages/aide/src/map.ts:130

Get the entries as an array.

Returns

[K, V][]

every()

every(predicate): boolean

Defined in: packages/aide/src/map.ts:137

Returns true if every entry in this map satisfies the given predicate.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------------------------------------------------------------------------- | | predicate | Predicate<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }> |

Returns

boolean

filter()

filter(predicate): MapPlus<K, V>

Defined in: packages/aide/src/map.ts:146

Create a new map by only keeping the entries that satisfies the provided predicate.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------------------------------------------------------------------------- | | predicate | Predicate<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }> |

Returns

MapPlus<K, V>

find()

find(predicate): Optional<V>

Defined in: packages/aide/src/map.ts:157

Get an optional for the first value that matches the given predicate.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------------------------------------------------------------------------- | | predicate | Predicate<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }> |

Returns

Optional<V>

forEach()

forEach(callbackfn, thisArg?): void

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:28

Executes a provided function once per each key/value pair in the Map, in insertion order.

Parameters

| Parameter | Type | | ------------ | --------------------------------- | | callbackfn | (value, key, map) => void | | thisArg? | any |

Returns

void

Inherited from

Map.forEach

get()

get(key): undefined | V

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:33

Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.

Parameters

| Parameter | Type | | --------- | ---- | | key | K |

Returns

undefined | V

Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

Inherited from

Map.get

getOrDefault()

getOrDefault(key, defaultValue): V

Defined in: packages/aide/src/map.ts:167

If this map has the provided key, return the value associated with that key, otherwise return the provided default value.

Parameters

| Parameter | Type | | -------------- | ---- | | key | K | | defaultValue | V |

Returns

V

getOrThrow()

getOrThrow(key): NonNullable<V>

Defined in: packages/aide/src/map.ts:174

Similar to Map#get but will throw an Error if the key does not exist.

Parameters

| Parameter | Type | | --------- | ---- | | key | K |

Returns

NonNullable<V>

groupBy()

groupBy<K2>(classifier): MapPlus<K2, MapPlus<K, V>>

Defined in: packages/aide/src/map.ts:185

Groups the entries of this map by the result of the classifier function.

Type Parameters

| Type Parameter | | ------------------------------------------ | | K2 extends MapPlusKey |

Parameters

| Parameter | Type | | ------------ | --------------------------------------------------------------------------------------------------------------- | | classifier | Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, K2> |

Returns

MapPlus<K2, MapPlus<K, V>>

has()

has(key): boolean

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:37

Parameters

| Parameter | Type | | --------- | ---- | | key | K |

Returns

boolean

boolean indicating whether an element with the specified key exists or not.

Inherited from

Map.has

isEmpty()

isEmpty(): boolean

Defined in: packages/aide/src/map.ts:204

Returns true if this map contains no key-value mappings.

Returns

boolean

keys()

keys(): MapIterator<K>

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:153

Returns an iterable of keys in the map

Returns

MapIterator<K>

Inherited from

Map.keys

keysArray()

keysArray(): K[]

Defined in: packages/aide/src/map.ts:211

Retrieve the keys as an array.

Returns

K[]

mapKeys()

mapKeys<R>(mapper): MapPlus<R, V>

Defined in: packages/aide/src/map.ts:220

Create a new version of this map with the keys mapped to a different value with the provided mapper. Please note that no consideration will be made in validate the keys are not duplicated meaning if the mapper function generates the same key multiple times, the later will override the previous value.

Type Parameters

| Type Parameter | | ----------------------------------------- | | R extends MapPlusKey |

Parameters

| Parameter | Type | | --------- | -------------------------------------------------------------------------------------------------------------- | | mapper | Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, R> |

Returns

MapPlus<R, V>

mapValues()

mapValues<R>(mapper): MapPlus<K, R>

Defined in: packages/aide/src/map.ts:232

Create a new version of this map with the values mapped to a different value with the provided mapper.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | -------------------------------------------------------------------------------------------------------------- | | mapper | Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, R> |

Returns

MapPlus<K, R>

set()

set(key, value): this

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:41

Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.

Parameters

| Parameter | Type | | --------- | ---- | | key | K | | value | V |

Returns

this

Inherited from

Map.set

setAll()

setAll(map): this

Defined in: packages/aide/src/map.ts:244

Set all key/value pair in the given map to this map.

Parameters

| Parameter | Type | | --------- | ------------------------------------------------------- | | map | Map<K, V> | Record<K, V> | [K, V][] |

Returns

this

setIfAbsent()

setIfAbsent(key, value): V

Defined in: packages/aide/src/map.ts:259

Set the provided value to the provided key if it doesn't exists, returning the new current value.

Parameters

| Parameter | Type | | --------- | ---- | | key | K | | value | V |

Returns

V

some()

some(predicate): boolean

Defined in: packages/aide/src/map.ts:271

Returns true if at least one entry in this map satisfies the provided predicate.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------------------------------------------------------------------------- | | predicate | Predicate<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }> |

Returns

boolean

toObject()

toObject<K2, V2>(__namedParameters): Record<K2, V2>

Defined in: packages/aide/src/map.ts:280

Convert this to an object of key/value pair with possibility of mapping the key and value.

Type Parameters

| Type Parameter | | ------------------------------------------ | | K2 extends MapPlusKey | | V2 |

Parameters

| Parameter | Type | | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | __namedParameters | { keyMapper: Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, K2>; valueMapper: Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, V2>; } | | __namedParameters.keyMapper? | Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, K2> | | __namedParameters.valueMapper? | Mapper<{ key: K; map: MapPlus<K, V>; value: NonNullable<V>; }, V2> |

Returns

Record<K2, V2>

values()

values(): MapIterator<V>

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:158

Returns an iterable of values in the map

Returns

MapIterator<V>

Inherited from

Map.values

valuesArray()

valuesArray(): V[]

Defined in: packages/aide/src/map.ts:301

Retrieves all values as an array.

Returns

V[]

groupBy()

static groupBy<K, T>(items, keySelector): Map<K, T[]>

Defined in: common/temp/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2024.collection.d.ts:25

Groups members of an iterable according to the return value of the passed callback.

Type Parameters

| Type Parameter | | -------------- | | K | | T |

Parameters

| Parameter | Type | Description | | ------------- | ------------------------ | -------------------------------------------------------- | | items | Iterable<T> | An iterable. | | keySelector | (item, index) => K | A callback which will be invoked for each item in items. |

Returns

Map<K, T[]>

Inherited from

Map.groupBy


PresentOptional<T>

Defined in: packages/aide/src/optional.ts:133

Wrapper around values that are either present or absent (null or undefined).

Type Parameters

| Type Parameter | | -------------- | | T |

Implements

Constructors

Constructor

new PresentOptional<T>(value): PresentOptional<T>

Defined in: packages/aide/src/optional.ts:134

Parameters

| Parameter | Type | | --------- | ------------------ | | value | NonNullable<T> |

Returns

PresentOptional<T>

Methods

filter()

filter(predicate): Optional<T>

Defined in: packages/aide/src/optional.ts:136

If a value is present and the value matches the given predicate, return an Optional describing the value, otherwise return an empty Optional.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------- | | predicate | Predicate<NonNullable<T>> |

Returns

Optional<T>

Implementation of

Optional.filter

flatMap()

flatMap<R>(mapper): Optional<R>

Defined in: packages/aide/src/optional.ts:140

If a value is present, apply the provided Optional-bearing mapping function to it, return that result, otherwise return an empty Optional. This method is similar to map, but the provided mapper is one whose result is already an Optional, and if invoked, flatMap does not wrap it with an additional Optional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | --------------------------------------------------------------------- | | mapper | Mapper<NonNullable<T>, Optional<R>> |

Returns

Optional<R>

Implementation of

Optional.flatMap

getOrThrow()

getOrThrow(): NonNullable<T>

Defined in: packages/aide/src/optional.ts:144

If the value is present, returns the value, otherwise throws an Error.

Returns

NonNullable<T>

Implementation of

Optional.getOrThrow

ifAbsent()

ifAbsent(handler): this

Defined in: packages/aide/src/optional.ts:148

If the value is absent, invoke the specified handler, otherwise do nothing.

Parameters

| Parameter | Type | | --------- | ----------------------- | | handler | Runnable |

Returns

this

Implementation of

Optional.ifAbsent

ifPresent()

ifPresent(consumer): this

Defined in: packages/aide/src/optional.ts:152

If a value is present, invoke the specified consumer with the value, otherwise do nothing.

Parameters

| Parameter | Type | | ---------- | ------------------------------------------- | | consumer | Consumer<NonNullable<T>> |

Returns

this

Implementation of

Optional.ifPresent

isAbsent()

isAbsent(): this is AbsentOptional<T>

Defined in: packages/aide/src/optional.ts:157

If a value is absent (null or undefined), returns true, otherwise false.

Returns

this is AbsentOptional<T>

Implementation of

Optional.isAbsent

isPresent()

isPresent(): this is PresentOptional<T>

Defined in: packages/aide/src/optional.ts:161

If a value is present, returns true, otherwise false.

Returns

this is PresentOptional<T>

Implementation of

Optional.isPresent

map()

map<R>(mapper): Optional<R>

Defined in: packages/aide/src/optional.ts:165

If a value is present, apply the provided mapping function to it, and if the result is present, return an Optional describing the result, otherwise, return an empty Optional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | -------------------------------------------- | | mapper | Mapper<NonNullable<T>, R> |

Returns

Optional<R>

Implementation of

Optional.map

or()

or(other): Optional<T>

Defined in: packages/aide/src/optional.ts:169

If a value is present, returns an Optional describing the value, otherwise returns an Optional produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ----------------------------------------------------- | | other | Supplier<Optional<T>> |

Returns

Optional<T>

Implementation of

Optional.or

orElse()

orElse(other): T

Defined in: packages/aide/src/optional.ts:173

If a value is present, returns the value, otherwise returns other.

Parameters

| Parameter | Type | | --------- | ---- | | other | T |

Returns

T

Implementation of

Optional.orElse

orElseGet()

orElseGet(other): T

Defined in: packages/aide/src/optional.ts:177

If a value is present, returns the value, otherwise returns the result produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ---------------------------- | | other | Supplier<T> |

Returns

T

Implementation of

Optional.orElseGet

orElseThrow()

orElseThrow<X>(other): T

Defined in: packages/aide/src/optional.ts:181

If a value is present, returns the value, otherwise throws an exception to be created by the provided supplier.

Type Parameters

| Type Parameter | | -------------- | | X |

Parameters

| Parameter | Type | | --------- | ---------------------------- | | other | Supplier<X> |

Returns

T

Implementation of

Optional.orElseThrow

orUndefined()

orUndefined(): NonNullable<T>

Defined in: packages/aide/src/optional.ts:185

If a value is present, returns the value, otherwise return undefined.

Returns

NonNullable<T>

Implementation of

Optional.orUndefined


Queue<T>

Defined in: packages/aide/src/queue.ts:76

Queue that execute handlers as per the configured concurrency limit. It also has the ability to rate limit how much execution happens within an interval.

Type Parameters

| Type Parameter | Default type | Description | | -------------- | ------------ | --------------------------------------------------------------------------------------- | | T | void | The type of the item that the promise resolves with for the handlers. Defaults to void. |

Constructors

Constructor

new Queue<T>(__namedParameters): Queue<T>

Defined in: packages/aide/src/queue.ts:146

Create a new instance.

Parameters

| Parameter | Type | Description | | ----------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | __namedParameters | { intervalMs: number; maxConcurrent: number; maxPerInterval: number; } | - | | __namedParameters.intervalMs? | number | If given in addition with maxPerInterval, used to limit how many items can execute within an interval. This is simply the time, in milliseconds, for when to reset the execution counts per interval. | | __namedParameters.maxConcurrent | number | Maximum number of concurrent executions. | | __namedParameters.maxPerInterval? | number | If given in addition with intervalMs, used to limit how many items can execute within an interval. This is simply the maximum number of executions within the interval. |

Returns

Queue<T>

Properties

| Property | Modifier | Type | Description | | -------------------------------------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | intervalMs | readonly | number | If given in addition with maxPerInterval, used to limit how many items can execute within an interval. This is simply the time, in milliseconds, for when to reset the execution counts per interval. | | maxConcurrent | readonly | number | Maximum number of concurrent executions. | | maxPerInterval | readonly | number | If given in addition with intervalMs, used to limit how many items can execute within an interval. This is simply the maximum number of executions within the interval. |

Methods

add()

add(item): { onAfterStart: Promise<void>; onBeforeStart: Promise<void>; onEnd: Promise<T>; }

Defined in: packages/aide/src/queue.ts:157

Add a new item to the queue for execution.

Parameters

| Parameter | Type | | --------- | ------------------------------ | | item | QueueItem<T> |

Returns

{ onAfterStart: Promise<void>; onBeforeStart: Promise<void>; onEnd: Promise<T>; }

| Name | Type | Description | | --------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------ | | onAfterStart | Promise<void> | Promised that is resolved right after the handler is executed but not necessarily after it has finished execution. | | onBeforeStart | Promise<void> | Promised that is resolved right before the handler is executed. | | onEnd | Promise<T> | Promised that is resolved after the handler finished executing. |

Throws

Error if items can no longer be added.

lockQueue()

lockQueue(): Promise<void>

Defined in: packages/aide/src/queue.ts:181

Lock the queue and return a promise that will resolve when all the handlers finished execution.

Returns

Promise<void>

Interfaces

AsyncOptional<T>

Defined in: packages/aide/src/async-optional.ts:15

Async version of Optional where handlers can be async functions.

Type Parameters

| Type Parameter | | -------------- | | T |

Methods

filter()

filter(predicate): AsyncOptional<T>

Defined in: packages/aide/src/async-optional.ts:20

If a value is present and the value matches the given predicate, return an AsyncOptional describing the value, otherwise return an empty AsyncOptional.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------------------------- | | predicate | AwaitablePredicate<NonNullable<T>> |

Returns

AsyncOptional<T>

flatMap()

flatMap<R>(mapper): AsyncOptional<R>

Defined in: packages/aide/src/async-optional.ts:26

If a value is present, apply the provided AsyncOptional-bearing mapping function to it, return that result, otherwise return an empty AsyncOptional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | ------------------------------------------------------------------------------------------------- | | mapper | AwaitableMapper<NonNullable<T>, AsyncOptional<R>> |

Returns

AsyncOptional<R>

getOrThrow()

getOrThrow(): Promise<NonNullable<T>>

Defined in: packages/aide/src/async-optional.ts:31

If the value is present, returns the value, otherwise throws an Error.

Returns

Promise<NonNullable<T>>

ifAbsent()

ifAbsent(handler): AsyncOptional<T>

Defined in: packages/aide/src/async-optional.ts:36

If the value is absent, invoke the specified handler, otherwise do nothing.

Parameters

| Parameter | Type | | --------- | ----------------------------------------- | | handler | AwaitableRunnable |

Returns

AsyncOptional<T>

ifPresent()

ifPresent(consumer): AsyncOptional<T>

Defined in: packages/aide/src/async-optional.ts:41

If a value is present, invoke the specified consumer with the value, otherwise do nothing.

Parameters

| Parameter | Type | | ---------- | ------------------------------------------------------------- | | consumer | AwaitableConsumer<NonNullable<T>> |

Returns

AsyncOptional<T>

isAbsent()

isAbsent(): Promise<boolean>

Defined in: packages/aide/src/async-optional.ts:46

If a value is absent (null or undefined), returns true, otherwise false.

Returns

Promise<boolean>

isPresent()

isPresent(): Promise<boolean>

Defined in: packages/aide/src/async-optional.ts:51

If a value is present, returns true, otherwise false.

Returns

Promise<boolean>

map()

map<R>(mapper): AsyncOptional<R>

Defined in: packages/aide/src/async-optional.ts:57

If a value is present, apply the provided mapping function to it, and if the result is present, return an AsyncOptional describing the result, otherwise, return an empty AsyncOptional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | -------------------------------------------------------------- | | mapper | AwaitableMapper<NonNullable<T>, R> |

Returns

AsyncOptional<R>

or()

or(other): AsyncOptional<T>

Defined in: packages/aide/src/async-optional.ts:63

If a value is present, returns an AsyncOptional describing the value, otherwise returns an AsyncOptional produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ----------------------------------------------------------------------- | | other | () => Awaitable<AsyncOptional<T>> |

Returns

AsyncOptional<T>

orElse()

orElse(other): Promise<T>

Defined in: packages/aide/src/async-optional.ts:68

If a value is present, returns the value, otherwise returns other.

Parameters

| Parameter | Type | | --------- | ---- | | other | T |

Returns

Promise<T>

orElseGet()

orElseGet(other): Promise<T>

Defined in: packages/aide/src/async-optional.ts:73

If a value is present, returns the value, otherwise returns the result produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ---------------------------------------------- | | other | AwaitableSupplier<T> |

Returns

Promise<T>

orElseThrow()

orElseThrow<X>(other): Promise<T>

Defined in: packages/aide/src/async-optional.ts:78

If a value is present, returns the value, otherwise throws an exception to be created by the provided supplier.

Type Parameters

| Type Parameter | | -------------- | | X |

Parameters

| Parameter | Type | | --------- | ---------------------------------------------- | | other | AwaitableSupplier<X> |

Returns

Promise<T>

orUndefined()

orUndefined(): Promise<undefined | NonNullable<T>>

Defined in: packages/aide/src/async-optional.ts:83

If a value is present, returns the value, otherwise return undefined.

Returns

Promise<undefined | NonNullable<T>>


Optional<T>

Defined in: packages/aide/src/optional.ts:6

Wrapper around values that are either present or absent (null or undefined).

Type Parameters

| Type Parameter | | -------------- | | T |

Methods

filter()

filter(predicate): Optional<T>

Defined in: packages/aide/src/optional.ts:11

If a value is present and the value matches the given predicate, return an Optional describing the value, otherwise return an empty Optional.

Parameters

| Parameter | Type | | ----------- | --------------------------------------------- | | predicate | Predicate<NonNullable<T>> |

Returns

Optional<T>

flatMap()

flatMap<R>(mapper): Optional<R>

Defined in: packages/aide/src/optional.ts:18

If a value is present, apply the provided Optional-bearing mapping function to it, return that result, otherwise return an empty Optional. This method is similar to map, but the provided mapper is one whose result is already an Optional, and if invoked, flatMap does not wrap it with an additional Optional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | --------------------------------------------------------------------- | | mapper | Mapper<NonNullable<T>, Optional<R>> |

Returns

Optional<R>

getOrThrow()

getOrThrow(): NonNullable<T>

Defined in: packages/aide/src/optional.ts:23

If the value is present, returns the value, otherwise throws an Error.

Returns

NonNullable<T>

ifAbsent()

ifAbsent(handler): this

Defined in: packages/aide/src/optional.ts:28

If the value is absent, invoke the specified handler, otherwise do nothing.

Parameters

| Parameter | Type | | --------- | ----------------------- | | handler | Runnable |

Returns

this

ifPresent()

ifPresent(consumer): this

Defined in: packages/aide/src/optional.ts:33

If a value is present, invoke the specified consumer with the value, otherwise do nothing.

Parameters

| Parameter | Type | | ---------- | ------------------------------------------- | | consumer | Consumer<NonNullable<T>> |

Returns

this

isAbsent()

isAbsent(): this is AbsentOptional<T>

Defined in: packages/aide/src/optional.ts:38

If a value is absent (null or undefined), returns true, otherwise false.

Returns

this is AbsentOptional<T>

isPresent()

isPresent(): this is PresentOptional<T>

Defined in: packages/aide/src/optional.ts:43

If a value is present, returns true, otherwise false.

Returns

this is PresentOptional<T>

map()

map<R>(mapper): Optional<R>

Defined in: packages/aide/src/optional.ts:49

If a value is present, apply the provided mapping function to it, and if the result is present, return an Optional describing the result, otherwise, return an empty Optional.

Type Parameters

| Type Parameter | | -------------- | | R |

Parameters

| Parameter | Type | | --------- | -------------------------------------------- | | mapper | Mapper<NonNullable<T>, R> |

Returns

Optional<R>

or()

or(other): Optional<T>

Defined in: packages/aide/src/optional.ts:55

If a value is present, returns an Optional describing the value, otherwise returns an Optional produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ----------------------------------------------------- | | other | Supplier<Optional<T>> |

Returns

Optional<T>

orElse()

orElse(other): T

Defined in: packages/aide/src/optional.ts:60

If a value is present, returns the value, otherwise returns other.

Parameters

| Parameter | Type | | --------- | ---- | | other | T |

Returns

T

orElseGet()

orElseGet(other): T

Defined in: packages/aide/src/optional.ts:65

If a value is present, returns the value, otherwise returns the result produced by the supplying function.

Parameters

| Parameter | Type | | --------- | ---------------------------- | | other | Supplier<T> |

Returns

T

orElseThrow()

orElseThrow<X>(other): T

Defined in: packages/aide/src/optional.ts:70

If a value is present, returns the value, otherwise throws an exception to be created by the provided supplier.

Type Parameters

| Type Parameter | | -------------- | | X |

Parameters

| Parameter | Type | | --------- | ---------------------------- | | other | Supplier<X> |

Returns

T

orUndefined()

orUndefined(): undefined | NonNullable<T>

Defined in: packages/aide/src/optional.ts:75

If a value is present, returns the value, otherwise return undefined.

Returns

undefined | NonNullable<T>


QueueConstructorOptions

Defined in: packages/aide/src/queue.ts:35

Arguments for constructing a Queue.

Properties

| Property | Type | Description | | ----------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | intervalMs? | number | If given in addition with maxPerInterval, used to limit how many items can execute within an interval. This is simply the time, in milliseconds, for when to reset the execution counts per interval. | | maxConcurrent | number | Maximum number of concurrent executions. | | maxPerInterval? | number | If given in addition with intervalMs, used to limit how many items can execute within an interval. This is simply the maximum number of executions within the interval. |


SingletonFunction()<T>

Defined in: packages/aide/src/function.ts:147

A function wrapper that implements singleton pattern with reset capabilities. The wrapped function will only execute once and cache its result until reset.

Type Parameters

| Type Parameter | | -------------- | | T |

SingletonFunction(): T

Defined in: packages/aide/src/function.ts:148

A function wrapper that implements singleton pattern with reset capabilities. The wrapped function will only execute once and cache its result until reset.

Returns

T

Methods

reset()

reset(): void

Defined in: packages/aide/src/function.ts:149

Returns

void

resetAndCall()

resetAndCall(): T

Defined in: packages/aide/src/function.ts:150

Returns

T

Type Aliases

AnyArray<V>

AnyArray<V> = V[] | ReadonlyArray<V>

Defined in: packages/aide/src/types.ts:11

Type matching against both a writable array and a readonly array.

Type Parameters

| Type Parameter | Description | | -------------- | ----------------------------------- | | V | The type of each item in the array. |


Awaitable<T>

Awaitable<T> = T | Promise<T>

Defined in: packages/aide/src/types.ts:4

The type is simply T or a promise which, when resolved, is given T.

Type Parameters

| Type Parameter | | -------------- | | T |


AwaitableBiConsumer()<T, U>

AwaitableBiConsumer<T, U> = (t, u) => Awaitable<void>

Defined in: packages/aide/src/function.ts:6

Represents an operation that accepts two input arguments and returns no result. This operation returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T | | U |

Parameters

| Parameter | Type | | --------- | ---- | | t | T | | u | U |

Returns

Awaitable<void>


AwaitableBiMapper()<T, U, R>

AwaitableBiMapper<T, U, R> = (t, u) => Awaitable<R>

Defined in: packages/aide/src/function.ts:11

Represents a function that accepts two arguments and produces a result. This function returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T | | U | | R |

Parameters

| Parameter | Type | | --------- | ---- | | t | T | | u | U |

Returns

Awaitable<R>


AwaitableBinaryOperator()<T>

AwaitableBinaryOperator<T> = (left, right) => Awaitable<T>

Defined in: packages/aide/src/function.ts:16

Represents an operation upon two operands of the same type, producing a result of the same type as the operands. This operation returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T |

Parameters

| Parameter | Type | | --------- | ---- | | left | T | | right | T |

Returns

Awaitable<T>


AwaitableBiPredicate()<T, U>

AwaitableBiPredicate<T, U> = (t, u) => Awaitable<boolean>

Defined in: packages/aide/src/function.ts:21

Represents a predicate (boolean-valued function) of two arguments. This predicate returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T | | U |

Parameters

| Parameter | Type | | --------- | ---- | | t | T | | u | U |

Returns

Awaitable<boolean>


AwaitableConsumer()<T>

AwaitableConsumer<T> = (t) => Awaitable<void>

Defined in: packages/aide/src/function.ts:26

Represents an operation that accepts a single input argument and returns no result. This operation returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T |

Parameters

| Parameter | Type | | --------- | ---- | | t | T |

Returns

Awaitable<void>


AwaitableMapper()<T, R>

AwaitableMapper<T, R> = (t) => Awaitable<R>

Defined in: packages/aide/src/function.ts:31

Represents a function that accepts one argument and produces a result. This function returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T | | R |

Parameters

| Parameter | Type | | --------- | ---- | | t | T |

Returns

Awaitable<R>


AwaitablePredicate()<T>

AwaitablePredicate<T> = (t) => Awaitable<boolean>

Defined in: packages/aide/src/function.ts:41

Represents a predicate (boolean-valued function) of one argument. This predicate returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T |

Parameters

| Parameter | Type | | --------- | ---- | | t | T |

Returns

Awaitable<boolean>


AwaitableRunnable()

AwaitableRunnable = () => Awaitable<void>

Defined in: packages/aide/src/function.ts:36

Represents a runnable task that takes no arguments and returns no result. This task returns an Awaitable.

Returns

Awaitable<void>


AwaitableSupplier()<T>

AwaitableSupplier<T> = () => Awaitable<T>

Defined in: packages/aide/src/function.ts:46

Represents a supplier of results. This supplier returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T |

Returns

Awaitable<T>


AwaitableTernaryOperator()<T>

AwaitableTernaryOperator<T> = (first, second, third) => Awaitable<T>

Defined in: packages/aide/src/function.ts:51

Represents an operation upon three operands of the same type, producing a result of the same type as the operands. This operation returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T |

Parameters

| Parameter | Type | | --------- | ---- | | first | T | | second | T | | third | T |

Returns

Awaitable<T>


AwaitableTriConsumer()<T, U, V>

AwaitableTriConsumer<T, U, V> = (t, u, v) => Awaitable<void>

Defined in: packages/aide/src/function.ts:56

Represents an operation that accepts three input arguments and returns no result. This operation returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T | | U | | V |

Parameters

| Parameter | Type | | --------- | ---- | | t | T | | u | U | | v | V |

Returns

Awaitable<void>


AwaitableTriMapper()<T, U, V, R>

AwaitableTriMapper<T, U, V, R> = (t, u, v) => Awaitable<R>

Defined in: packages/aide/src/function.ts:61

Represents a function that accepts three arguments and produces a result. This function returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T | | U | | V | | R |

Parameters

| Parameter | Type | | --------- | ---- | | t | T | | u | U | | v | V |

Returns

Awaitable<R>


AwaitableTriPredicate()<T, U, V>

AwaitableTriPredicate<T, U, V> = (t, u, v) => Awaitable<boolean>

Defined in: packages/aide/src/function.ts:66

Represents a predicate (boolean-valued function) of three arguments. This predicate returns an Awaitable.

Type Parameters

| Type Parameter | | -------------- | | T | | U | | V |

Parameters

| Parameter |