Socket
Socket
Sign inDemoInstall

check-typeof

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    check-typeof

A Node.js library offering functions to check variable types, including arrays, objects, strings, numbers, booleans, and undefined values.


Version published
Maintainers
1
Created

Readme

Source

Type Checker for Node.js

A Node.js package for checking variable types: array, object, string, number, boolean, or undefined.

Installation

Install the package via npm:

npm install check-typeof --save

Usage

    const $ = require('check-typeof');

    // Check if the variable is an array
    if ($.isArray(variableName)) {
        // Your code for array type
    }

    // Check if the variable is an object
    if ($.isObject(variableName)) {
        // Your code for object type
    }

    // Check if the variable is a string
    if ($.isString(variableName)) {
        // Your code for string type
    }

    // Check if the variable is a number
    if ($.isNumber(variableName)) {
        // Your code for number type
    }

    // Check if the variable is a boolean
    if ($.isBoolean(variableName)) {
        // Your code for boolean type
    }

    // Check if the variable is undefined
    if ($.isUndefined(variableName)) {
        // Your code for undefined type
    }

Keywords

FAQs

Last updated on 10 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc