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

@lvchengbin/is

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lvchengbin/is

A library, which is possible to be imported as ES6 module separately, for checking the type of a value.

  • 0.0.18
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2K
increased by1.09%
Maintainers
1
Weekly downloads
 
Created
Source

Is

A JavaScript library for checking the type of a value for browsers.

  • Installing
  • Usage
  • Using in browsers
  • Method List

Installing

npm i @lvchengbin/is --save

Usage

Generally, when we are using some toolkit such as rollup, we don't want to compile a huge library into our project, therefore, to import the files you really need.

import isFunction from '@lvchengbin/is/src/function';
import array from '@lvchengbin/is/src/array';

isFunction( async () => {} );
isArray( [] );

If you want to invoke the whole package:

import is from '@lvchengbin/is';

is.function( () => {} );
is.array( [] );

Using in browsers

If you want to invoke this package to browsers with <script> tag or something like that, use is.js. For old browsers which are not supporting ES5 syntax, use is.bc.js.

Method List

MethodImportingDesc
is.argumentsimport isArguments from '@lvchengbin/is/src/arguments'
is.arrayimport isArray from '@lvchengbin/is/src/array'
is.arrowFunctionimport isArrowFunction from '@lvchengbin/is/src/arrow-function'
is.asyncFunctionimport isAsyncFunction from '@lvchengbin/is/src/async-function'
is.booleanimport isBoolean from '@lvchengbin/is/src/boolean'
is.dateimport isDate from '@lvchengbin/is/src/date'
is.dateStringimport isDateString from '@lvchengbin/is/src/date-string'????
is.emailimport isEmail from '@lvchengbin/is/src/email'
is.emptyimport isEmpty from '@lvchengbin/is/src/empty'
is.errorimport isError from '@lvchengbin/is/src/error'
is.falseimport isFalse from '@lvchengbin/is/src/false'
is.functionimport isFunction from '@lvchengbin/is/src/function'
is.integerimport isInteger from '@lvchengbin/is/src/integer'
is.iterableimport isIterable from '@lvchengbin/is/src/iterable'
is.numberimport isNumber from '@lvchengbin/is/src/number'
is.objectimport isObject from '@lvchengbin/is/src/object'
is.plainObjectimport isPlainObject from '@lvchengbin/is/src/plain-object'
is.promiseimport isPromise from '@lvchengbin/is/src/promise'
is.regexpimport isRegexp from '@lvchengbin/is/src/regexp'
is.stringimport isString from '@lvchengbin/is/src/string'
is.trueimport isTrue from '@lvchengbin/is/src/true'
is.undefinedimport isUndefined from '@lvchengbin/is/src/undefined'
is.urlimport isUrl from '@lvchengbin/is/src/url'
is.nodeimport isNode from '@lvchengbin/is/src/node'
is.textNodeimport isTextNode from '@lvchengbin/is/src/text-node'
is.elementNodeimport isElementNode from '@lvchengbin/is/src/element-node'
is.windowimport isWindow from '@lvchengbin/is/src/window'
is.classimport isClass from '@lvchengbin/is/src/class'
is.ipv4import isIPv4 from '@lvchengbin/is/src/ipv4'
is.ipv6import isIPv6 from '@lvchengbin/is/src/ipv6'
is.ipimport isIP from '@lvchengbin/is/src/ip'
is.generatorimport isGenerator from '@lvchengbin/is/src/generator'

is.date

For checking if an object is a Date instance.

import isDate from '@lvchengbin/is/src/date';

isDate( new Date ); // return true

is.empty

an empty value could be am empty object({}), an empty string, an empty array([]), a number 0 or a false |

For checking if a value is empty, and empty values include empty object ({}), empty string (''), empty array ([]), number 0, false.

import isEmpty from '@lvchengbin/is/src/empty';

isEmpty( '' ); // return true
isEmpty( [] ); // return true
isEmpty( {} ); // return true
isEmpty( 0 ); // return true
isEmpty( false ); // return true

is.false

For checking if a value is false, if the second argument is true (by default), the function will check a generalized false, it means that the following strings all mean false: "false", "no", "0", "", "nay", "n", "disagree".

import isFalse from '@lvchengbin/is/src/false';

isFalse( false ); // returns true
isFalse( 'false' ); // returns true
isFalse( 'false', false ); // returns false

is.true

For checking if a value is true, if the second argument is true (by default), the function will check a generalized true, it means that the following strings all mean true: "true", "true", "yes", "ok", "1", "yea", "yep", "y", "agree".

import isTrue from '@lvchengbin/is/src/true';
isTrue( true ); // returns true
isTrue( 'true' ); // returns true
isTrue( 'true', false ); // returns false

Keywords

FAQs

Package last updated on 12 Jul 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