Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is

the definitive JavaScript type testing library

  • 3.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2M
increased by7.58%
Maintainers
2
Weekly downloads
 
Created

What is is?

The 'is' npm package provides a set of utility functions for type checking and validation. It allows developers to easily determine the type of a variable, check for specific conditions, and validate data types.

What are is's main functionalities?

Type Checking

The 'is' package provides functions to check the type of a variable. For example, 'is.string' checks if a value is a string, 'is.number' checks if a value is a number, and 'is.array' checks if a value is an array.

const is = require('is');

console.log(is.string('hello')); // true
console.log(is.number(123)); // true
console.log(is.array([1, 2, 3])); // true

Existence Checks

The 'is' package includes functions to check for the existence and truthiness of values. 'is.empty' checks if a value is empty, 'is.existy' checks if a value exists (is not null or undefined), and 'is.truthy' checks if a value is truthy.

const is = require('is');

console.log(is.empty([])); // true
console.log(is.existy(null)); // false
console.log(is.truthy(1)); // true

Regex and String Checks

The 'is' package provides functions to validate strings against common patterns. For example, 'is.email' checks if a string is a valid email address, 'is.url' checks if a string is a valid URL, and 'is.creditCard' checks if a string is a valid credit card number.

const is = require('is');

console.log(is.email('test@example.com')); // true
console.log(is.url('https://www.example.com')); // true
console.log(is.creditCard('4111111111111111')); // true

Other packages similar to is

Keywords

FAQs

Package last updated on 14 Dec 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