JSPM

is-obj-type

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q22107F
  • License GPL-3.0

Good judgment of object type.

Package Exports

  • is-obj-type

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-obj-type) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-obj-type

Good judgment of object type.

install

$ npm install --save isType

Example

const is = require('is-obj-type');
console.log(is.num(2));

var some = function(){
    //...
}
var obj = new some();
var isSome = is("some");
console.log(isSome(obj));

class someCls{};
var someObj = new someCls();
var isSomeCls = is("someCls");
console.log(isSomeCls(someObj));

var isSomeOrCls = is.all("some","someCls");
console.log(isSomeOrCls(obj));
console.log(isSomeOrCls(someObj));

output

true // x5

Usage

const is = require('isType');

Standard object

is.num(1); // => true
is.str(""); // => true
is.bool(true); // => true
is.arr([]); // => true
is.null(null); // => true
is.func(()=>{}); // => true
is.obj({}); // => true
is.undefined(undefined); // => true
is.symbol(Symbol("symbol")); // => true
is.global(window); // Browser
is.global(global); // Node

Plain object pair object

is.plain(new function(){}) // => false
is.plain(Object.create(null)) // => false
is.plain({})// => true

Custom class

var some = function(){};
var sObj = new some();
var isSome = is("some");
isSome(sObj);// => true

class somecls{};
var clsObj = new somecls();
var isSomecls = is("somecls");
isSomecls(clsObj);// => true

mulit condition

var isSomeOrCls = is.all("some","somecls");
isSomeOrCls(sObj);// => true
isSomeOrCls(clsObj);// => true

Advanced

Function Class overloading

// ...

About

*npm(new release) need to pull dev-lib with cmd
npm i --only=dev

browserify

$ npm run browserify

test

$ npm run test