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

3.0.1 • 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.

Readme

Keywords

none

Package Sidebar

Install

npm i @shopify/predicates

Weekly Downloads

83,272

Version

3.0.1

License

MIT

Unpacked Size

9.38 kB

Total Files

15

Last publish

Collaborators

  • jaimie.rockburn
  • blittle
  • shopify-admin
  • maryharte
  • crisfmb
  • pmoloney89
  • netlohan
  • st999999
  • justin-irl
  • megswim
  • wcandillon
  • nathanpjf
  • shopify-dep
  • goodforonefare
  • lemonmade
  • vsumner
  • wizardlyhel
  • antoine.grant
  • tsov
  • andyw8-shopify
  • henrytao
  • hannachen
  • vividviolet
  • bpscott