@xylabs/exists
v5.0.97
Published
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Readme
@xylabs/exists
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Install
Using npm:
npm install {{name}}Using yarn:
yarn add {{name}}Using pnpm:
pnpm add {{name}}Using bun:
bun add {{name}}License
See the LICENSE file for license rights and limitations (LGPL-3.0-only).
Reference
packages
exists
### .temp-typedoc
### functions
### <a id="exists"></a>existsfunction exists<T>(x?): x is NonNullable<T>;Used to type narrow an object which is possibly null or undefined. Works well with functional Array methods. For example:
Type Parameters
T
T
Parameters
x?
T | null
The object which is potentially undefined or null
Returns
x is NonNullable<T>
False if the object is null/undefined, true otherwise
Example
const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []