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

    3.0.0 • 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

    85,767

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    10.5 kB

    Total Files

    16

    Last publish

    Collaborators

    • wcandillon
    • jplhomer
    • marytal
    • themallen
    • nathanpjf
    • shopify-dep
    • goodforonefare
    • lemonmade
    • vsumner
    • wizardlyhel
    • antoine.grant
    • tsov
    • andyw8-shopify
    • henrytao
    • hannachen
    • andrewapperley
    • iainmcampbell
    • vividviolet
    • bpscott