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

isnot

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isnot

All imaginable type checking utils with negation

  • 0.5.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

isnot

Type checking package for JavaScript, include just once in your entrypoint like

you need to fetch every single function like const {isString} = require('isnot');

Available functions

Strings

isString('') //true

isNotString(()=>{}) //true

isStringAndNotEmpty('') //false

isStringAndNotEmpty(' ') //false

isStringAndNotEmpty('hey') //true

isEmptyString({}) //false

isEmptyString('') //true

isNotEmptyString('') //false

isEmail('a@b.c') //true

isNotEmail('whatever@domain') //true

isVariableName('var') //true (technically not, but it can be a property of an object accessed without ['...'])

isVariableName('oh dear') //false

isVariableName('0rel') //false cannot start with number

isVariableName('var0') //true

isNotVariableName('a@a') //true

Arrays

isArray([]) // true

isArray({}) // false

isEmptyArray([]) // true

isEmptyArray({}) // false

isNotEmptyArray([]) // false

isNotEmptyArray([1]) // true

isNotEmptyArray({}) // false

Objects

isObject([]) // FALSE, arrays are not objects for this library

isObject({}) // true

isNotObject('') //true

isEmptyObject([]) //false

isNotEmptyObject({a: 1}) //true

Numbers

isNumber(1) //true

isNotNumber(NaN) //true

isInt(0) //true

isNotInt(1.2) //true

Bool

isBool(1) //false

isNotBool(NaN) //true

isBool(0) //false

isBool(true) //true

Generic

isEmpty([]) //true

isEmpty('') //true

isEmpty(' ') //true

isEmpty({}) //true

isEmpty(null) //true

isEmpty(undefined) //true

isEmpty(0) //false

isNotEmpty('hey') //true

Dates

isDate('') //false

isNotDate('') //true

isDate(new Date()) //true

isDate('1970-01-01T00:00:00.000Z') //true

isDate('1970-01-01T00:00:00') //true

isDate('1970-01-01T00:00') //true

isDate('1970-01-01') //true

isDate('0000-00-00') //false

isDate('1970-13-01') //false (bad month)

isDate('1970-01-32') //false (bad day)

isDate('2017-02-29') //false (not leap year)

undefined

isUndefined('') //false

isUndefined(false) //false

isUndefined(undefined) //true

isUndefined(typeof undefined) //false

isUndefined({}.inventedProp) //true

Keywords

FAQs

Package last updated on 04 Feb 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc