New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

functional-predicates

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

functional-predicates

Library for creating common predicates.

0.1.0
latest
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Functional Predicates

Library for creating common predicates.

Useage

var is = require('functional-predicates');

var isDefined = is.defined()
var isDefined = is.undefined(false)
  // isDefined(undefined) === false

var isUndefined = is.undefined()
var isUndefined = is.defined(false)
  // isUndefined(undefined) === true

var isString = is.typeof('string')
  // isString('hello') === true

var isObject = is.instanceof(Object)
  // isObject(new Object()) === true

var isHello = is.equal('hello')
  // isHello('hello') === true

var isLt7 = is.lt(7)
  // isLt7(3) === true

var isGt12 = is.gt(12)
  // isGt12(7) === false

var isBeforeDec = is.before('Dec 31, 2015')
  // isBeforeDec('August 22, 2015') === true

var isAfterJul = is.after('July 1, 2015')
  // isAfterJul('August 22, 2015') === true

var isBetween20And45 = is.between(20, 45)
  // isBetween20And45(30) === true

var isBetweenJulAndDec = is.between('July 1, 2015', 'Dec 31, 2015')
  // isBetweenJulAndDec('August 22, 2015') === true

var isLongerThan10 = is.longer(10)
  // isLongerThan10('hello') === false

var isShorterThan12 = is.shorter(12)
  // isShorterThan12([1,2]) === true

var hasHello = is.includes('hello')
  // hasHello('hello world') === true

var has7 = is.includes(7)
  // has7([6,7,8]) === true

var hasNumbers = is.matches()
  // hasNumbers('123abc') === true

Library

  • defined()
  • undefined()
  • typeof(type);
  • instanceof(object);
  • equal(value)
  • lt(num);
  • gt(num);
  • between(num, num);
  • before(date);
  • after(date);
  • longer(length);
  • shorter(length);
  • includes(substr);
  • matches(regex);

Keywords

predicates

FAQs

Package last updated on 02 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts