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

check-types

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-types

A little library for asserting types and values.

  • 11.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5M
decreased by-12.8%
Maintainers
1
Weekly downloads
 
Created

What is check-types?

The check-types npm package provides a collection of functions for asserting types and values in JavaScript. It is designed to help developers enforce type safety and data integrity in their applications by offering a simple and intuitive API for type checking and validation.

What are check-types's main functionalities?

Primitive Type Checking

This feature allows you to check if a value is of a specific primitive type, such as a number, string, or boolean. The code sample demonstrates how to use the package to verify that a value is a number, a string, and a boolean.

const check = require('check-types');

console.log(check.number(42)); // true
console.log(check.string('hello')); // true
console.log(check.boolean(false)); // true

Object and Array Checking

With this feature, you can check if a value is an array or an object. The code sample shows how to validate that a value is an array and an object.

const check = require('check-types');

console.log(check.array([1, 2, 3])); // true
console.log(check.object({ key: 'value' })); // true

Function and Null Checking

This feature enables you to verify if a value is a function or null. The provided code sample illustrates how to check for a function and a null value.

const check = require('check-types');

console.log(check.function(function() {})); // true
console.log(check.null(null)); // true

Other packages similar to check-types

Keywords

FAQs

Package last updated on 23 Dec 2019

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