Giter VIP home page Giter VIP logo

help-is's Introduction

help-is

Small js package I use to test if a value is... (a number, a function...)

XO code style GitHub workflow status npm bundle size npm downloads

Install

$ npm install help-is

Import

This package is pure ESM. It cannot be require()'d from CommonJS.

Use import foo from 'foo' instead of const foo = require('foo') to import the package.

// Load entire build
import is from 'help-is';

If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).

You also need to make sure you're on the latest minor version of Node.js. At minimum Node.js 12.20, 14.14, or 16.0.

Read more here: sindresorhus/esm-package

Usage

is.string([1, 2, 3]);
//=> false

is.string('Hello');
//=> true

API

is.a(value, type) alias is.type(value, type) : Test if value is a type of type.

is.defined() : Test if value is defined.

is.empty() : Test if value is empty.

is.hosted(value, host) : Test if value is hosted by host.

is.instance(value, constructor) alias is.instanceof(value, constructor)

is.nil() alias is.null() : Test if value is null.

is.undef() alias is.undefined() : Test if value is undefined.

is.args() alias is.arguments() : Test if value is an arguments object.

is.args.empty() : Test if value is an empty arguments object.

is.array() : Test if 'value' is an array.

is.array.empty() : Test if value is an empty array.

is.arraylike() : Test if value is an arraylike object.

is.bool() alias is.boolean() : Test if value is a boolean.

is.false() : Test if value is false.

is.true() : Test if value is true.

is.date() : Test if value is a date.

is.date.valid() : Test if value is a valid date.

is.element() : Test if value is an html element.

is.error() : Test if value is an error object.

is.fn() alias is.function() : Test if value is a function.

is.thenable() : Test if value is a function and then can be called.

is.promise() : Test if value is a promise.

is.num() alias is.number() : Test if value is a number.

is.infinite() : Test if value is positive or negative infinity.

is.decimal() : Test if value is a decimal number.

is.int() alias is.integer() : Test if value is an integer.

is.safeInteger() : Test if value is a 'safe' integer.

is.bigInt() : Test if value is a BigInt.

is.float() : Test if value is a float.

is.nan() : Test if value is not a number.

is.object() : Test if value is an object.

is.primitive() : Test if value is a primitive.

is.hash() : Test if value is a hash - a plain object literal.

is.regexp() : Test if value is a regular expression.

is.string() : Test if value is a string.

is.base64() : Test if value is a valid base64 encoded string.

is.hex() : Test if value is a valid hex encoded string.

is.symbol() : Test if value is a Symbol.

is.event() : Test if value is a prototype.

is.map() : Test if value is a Map.

is.weakMap() : Test if value is a WeakMap.

is.set() : Test if value is a Set.

is.weakSet() : Test if value is a WeakSet.

is.node() : Test if environment is Node.

is.browser() : Test if environment is Browser.

License

MIT © Paul Nodet

help-is's People

Contributors

pnodet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.