
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@xylabs/promise
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
@xylabs/promise
Promise<T>T
V = void
new PromiseEx<T, V>(func, value?): PromiseEx<T, V>;
V
PromiseEx<T, V>
Promise<T>.constructor
optional cancelled: boolean;
then<TResult1, TResult2>(
onfulfilled?,
onrejected?,
onvalue?): Promise<TResult1 | TResult2>;
Attaches callbacks for the resolution and/or rejection of the Promise.
TResult1 = T
TResult2 = never
The callback to execute when the Promise is resolved.
null | (value) => TResult1 | PromiseLike<TResult1>
The callback to execute when the Promise is rejected.
null | (reason) => TResult2 | PromiseLike<TResult2>
(value?) => boolean
Promise<TResult1 | TResult2>
A Promise for the completion of which ever callback is executed.
Promise.then
value(onvalue?): PromiseEx<T, V>;
(value?) => boolean
PromiseEx<T, V>
function fulfilled<T>(val): val is PromiseFulfilledResult<T>;
For use with Promise.allSettled to filter only successful results
T
PromiseSettledResult<T>
val is PromiseFulfilledResult<T>
function fulfilledValues<T>(previousValue, currentValue): T[];
For use with Promise.allSettled to reduce to only successful result values
T
T[]
PromiseSettledResult<T>
T[]
const resolved = Promise.resolve('resolved')
const rejected = Promise.reject('rejected')
const settled = await Promise.allSettled([resolved, rejected])
const results = settled.reduce(fulfilledValues, [] as string[])
// results === [ 'resolved' ]
const resolved = Promise.resolve('resolved')
const rejected = Promise.reject('rejected')
const settled = await Promise.allSettled([resolved, rejected])
const results = settled.reduce<string[]>(fulfilledValues, [])
// results === [ 'resolved' ]
function isPromise(value): value is Promise<unknown>;
unknown
value is Promise<unknown>
function rejected<T>(val): val is PromiseRejectedResult;
For use with Promise.allSettled to filter only rejected results
T
PromiseSettledResult<T>
val is PromiseRejectedResult
function toPromise<T>(value): Promise<T>;
T
Promisable<T>
Promise<T>
then: () => unknown;
unknown
type AnyNonPromise = Exclude<TypedValue, PromiseType>;
type AsyncMutex<T> = Promise<T>;
T
Used to document promises that are being used as Mutexes
type NullablePromisable<T, V> = Promisable<T | null, V>;
T
V = never
type NullablePromisableArray<T, V> = PromisableArray<T | null, V>;
T
V = never
type OptionalPromisable<T, V> = Promisable<T | undefined, V>;
T
V = never
type OptionalPromisableArray<T, V> = PromisableArray<T | undefined, V>;
T
V = never
type Promisable<T, V> = PromiseEx<T, V> | Promise<T> | T;
T
V = never
type PromisableArray<T, V> = Promisable<T[], V>;
T
V = never
type PromiseExFunc<T> = (resolve?, reject?) => void;
T
PromiseExSubFunc<T, void>
PromiseExSubFunc<T, void>
void
type PromiseExSubFunc<T, TResult> = (value) => TResult;
T
TResult = T
T
TResult
type PromiseExValueFunc<V> = (value?) => boolean;
V
V
boolean
Part of sdk-js
See the LICENSE file for license details
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/promise receives a total of 7,744 weekly downloads. As such, @xylabs/promise popularity was classified as popular.
We found that @xylabs/promise demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.