New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

hd-types-check

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hd-types-check

hd-types-check 是一个校验实例类型的库,支持js的所有基本类型包括string、number、null、boolean、undefined,引用类型包括object、array、function、date。

latest
npmnpm
Version
1.0.2
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

hd-types-check

hd-types-check 是一个校验实例类型的库,支持js的所有基本类型包括string、number、null、boolean、undefined,引用类型包括object、array、function、date。

使用过程

npm install --save hd-types-check 或 yarn add hd-types-check

import Types from "hd-types-check"

使用方法介绍

Types函数需要一个参数 @param {*} instance 任意一个实例 @returns 返回当前实例的类型,包括string、number、null、boolean、undefined、object、array、function、date

Types(123)  // number
Types("hello word")     // string
Types(null)       // null
Types(true)       // boolean
Types(undefined)  // undefined
Types({})         // object
Types([])         // array
Types(() => {})   // function
Types(new Date()) // date

Types挂载的方法

Types.isNumber(123)      // true
Types.isString("hello")      // true
Types.isNull(null)      // true
Types.isBoolean(false)      // true
Types.isObject({})      // true
Types.isArray([])      // true
Types.isFunction(() => {})      // true
Types.isDate(new Date())      // true

Keywords

types

FAQs

Package last updated on 23 Dec 2021

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