nodetype

Checking for variable type

Usage no npm install needed!

<script type="module">
  import nodetype from 'https://cdn.skypack.dev/nodetype';
</script>

README

NODE-TYPE

Installation

npm install nodetype

Usage

// nodetype.check(type, value, convert);
nodetype.check('Boolean', 'True', true);


function MyObject () {
    this.hello = 'world';
    this.world = 'hello';
}

nodetype.set('MyObject', function (val) {
    return (val.hello || undefined) === 'world' && (val.world || undefined) === 'hello';
});

var myobj = new MyObject;

console.log(nodetype.check('MyObject', myobj));