@the-standard/conditions
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Conditions

This library contains common conditions that are checked in javascript and have been condensed down to simlple helper functions.

The current functions provided by this package are defined below.

  • isNil(x): Checks that the value is either null or undefined

An example usage of this library is provided below.

import { isNil } from '@the-standard/conditions';

// ...

function getUser(userId: string) {
    const user = userBroker.getUserById(userId);
    if (isNil(user)) {
        // handle null/undefined case;
    }
    // handle any additional validations
    return user;
}

This package supports typescript types and each of the condition checks also provide type guards to simplify typescript code.

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i @the-standard/conditions

    Weekly Downloads

    0

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    5.02 kB

    Total Files

    13

    Last publish

    Collaborators

    • ecoulson