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

kind-of

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kind-of

Get the native type of a value.

  • 6.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
163M
increased by69.02%
Maintainers
2
Weekly downloads
 
Created

What is kind-of?

The kind-of npm package is a utility library that allows developers to check the type of a given value in JavaScript. It provides a simple API to determine whether a value is a string, number, array, object, function, and other JavaScript types. This can be particularly useful for type checking and validation in applications where type safety is important.

What are kind-of's main functionalities?

Type checking for primitives

This feature allows you to check the type of primitive values such as numbers, strings, and booleans.

"use strict"; const kindOf = require('kind-of'); console.log(kindOf(1)); // 'number' console.log(kindOf('hello')); // 'string' console.log(kindOf(true)); // 'boolean'

Type checking for objects

This feature allows you to check the type of object-based values such as plain objects, arrays, and regular expressions.

"use strict"; const kindOf = require('kind-of'); console.log(kindOf({})); // 'object' console.log(kindOf([])); // 'array' console.log(kindOf(/foo/)); // 'regexp'

Type checking for functions and undefined

This feature allows you to check the type of functions and the undefined value.

"use strict"; const kindOf = require('kind-of'); console.log(kindOf(function () {})); // 'function' console.log(kindOf(undefined)); // 'undefined'

Type checking for null and dates

This feature allows you to check the type of null values and date objects.

"use strict"; const kindOf = require('kind-of'); console.log(kindOf(null)); // 'null' console.log(kindOf(new Date())); // 'date'

Other packages similar to kind-of

Keywords

FAQs

Package last updated on 16 Jan 2020

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