Wondering what’s next for npm?Check out our public roadmap! »

    @shopify/predicates
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.4 • Public • Published

    @shopify/predicates

    Build Status Build Status License: MIT npm version

    A set of common JavaScript predicates. The functions in this library either take one input and return true/false, or return a customized function that does so.

    Installation

    $ yarn add @shopify/predicates

    API

    Predicates

    • isPositiveNumericString Returns true when its input is a positive numeric string and false otherwise.
    • isNumericString Returns true when its input is a numeric string and false otherwise.
    • isEmpty Returns true when its input is null, undefined, or has length 0.
    • isEmptyString Returns true when it's input is an empty string or contains only whitespace.
    • notEmpty Returns true when its input is not null, undefined or has length 0.
    • notNumericString Returns true when its input is not a numeric string and false otherwise.

    Predicate creators

    • lengthMoreThan Given a number, returns a function that returns true when that input has length more than that number and false otherwise.
    • lengthLessThan Given a number, returns a function that returns true when that input has length less than that number and false otherwise.

    Helpers

    • not Given a function that returns a boolean, returns a function that returns a boolean in the opposite cases.

    Keywords

    none

    Install

    npm i @shopify/predicates

    DownloadsWeekly Downloads

    61,641

    Version

    1.3.4

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    21

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar