1.4.14
executor of checks to delegate a data for checking have a ability use upper case when string annotation name checks used
(String)
it can be name of branch/check
(any)
it can be name of branch/check
Boolean
:
// the same
is('platform', 'browser');
is.platform('browser');
is.platform.browser();
typeof return name of the data type it can return all 10 data types plus new data types of ES6.
(any)
String
:
is.typeof([]); // => 'array'
is('typeof', []); // => 'array'
It determine only NaN
(any)
Boolean
:
is.nan(NaN); // => true
is('NaN', NaN); // => true
is('NaN', 'NaN'); // => false
It determine only infinity's
(any)
Boolean
:
is.infinity(-Infinity); // => true
is('Infinity', Infinity); // => true
is('Infinity', 9999999*9999999*9999999); // => true
It determine only null
(any)
Boolean
:
is.null(null); // => true
is('null', null); // => true
// otherwise false
It determine only numbers (like a native typeof)
(any)
Boolean
:
is.number(1); // => true
is.number(NaN); // => true
is('number', null); // => false
It determine only strings
(any)
Boolean
:
is.string(''); // => true
is('string', 'null'); // => true
is('string', []); // => false
It determine only booleans
(any)
Boolean
:
is.boolean(true); // => true
is('boolean', false); // => true
// otherwise false
It determine only functions
(any)
Boolean
:
is.function(Function); // => true
is('function', Function); // => true
It determine only array
(any)
Boolean
:
is.array([]); // => true
is('array', [1,2]); // => true
is('array', '1,2'); // => false
It determine only objects. Except null and array
(any)
Boolean
:
is.object({}); // => true
is('object', {x:1}); // => true
is('object', []); // => false
is('object', null); // => false
It determine only undefined
(any)
Boolean
:
is.undefined(undefined); // => true
is('undefined', void(0)); // => true
always success except undefined
(any)
Boolean
:
is.defined(null); // => true
is('defined', 0); // => true
is('defined', void(0)); // => false
It determine only objects of customers (developers)
(any)
Boolean
:
is._object({}); // => true
is('_object', {x:1}); // => true
is('_object', new (class q {})); // => true
is('_object', null); // => false
is('_object', new Date); // => false
is('_object', new Error); // => false
It determine only numbers not NaN or Infinity or NUMBER more than possible to consider
(any)
Boolean
:
is._number(1); // => true
is._number(NaN); // => false
is('_number', null); // => false
is('_number', 9999999*9999999*9999999); // => false
It determine classes.
(any)
Boolean
:
class q {}
class q1 extends q {}
function Class (){}
is.class( Class ); // => false
is.class( q ); // => true
is('Class', q1 ); // => true
strict comparison to equivalent between arguments
* circular structure cannot be equaled. It returns false
(any)
(any)
Boolean
:
is('_equal', [1,{x:2}],[1,{x:1}]); // => false
is('_equal', [1,{x: Function}],[1,{x:function(){}}]);// => false
is('_equal', [1,{x:'1'}],[1,{x:1}]);// => false
is('_equal', [1,{x:1}],[1,{x:1}]); // => true
is._equal(); // => true becose (undefined, undefined)
is._equal(NaN, NaN); // => true
comparison to equivalent between arguments ignores difference in functions ignores data types difference if it equivalent (1,'1')
* circular structure cannot be equaled. It returns false
(any)
(any)
Boolean
:
is('equal', [1,{x:2}],[1,{x:1}]); // => false
is('equal', [1,{x:'1'}],[1,{x:1}]);// => true
is('equal', [1,{x:1}],[1,{x:1}]); // => true
is.equal(); // => true becose (undefined, undefined)
is.equal(NaN, NaN); // => true
is('equal', [1,{x: Function}],[1,{x:function(){}}]);// => true
check the data that may contain child elements. Otherwise returns false.
* can work not safe and throws an error when data is incorrect.
(any)
without "notSafe" can check any data type
(Boolean
= false
)
Boolean
:
is.empty([]); // true
is('empty', ''); // true
is('empty', {}); // true
is.empty([1]); // true
is('empty', '[]'); // true
It determine only numbers of possible to consider
(any)
Boolean
:
is.finite(1); // => true
is.finite(NaN); // => false
is('finite', null); // => false
is('finite', 9999999*9999999*9999999); // => false
It determine value can be involved in mathematical operations
(any)
Boolean
:
is.countable(1); // => true
is.countable('1'); // => true
is.countable(true); // => true
is.countable(NaN); // => false
is('countable', null); // => false
is('countable', 9999999*9999999*9999999); // => false
It determine object of native Date ( some things like (new Date()) instanceof Date )
(any)
Boolean
:
is.date(new Date); // => true
is('date', new Date); // => true
It determine object of error
(any)
Boolean
:
is.error(new Error); // => true
is('error', new TypeError); // => true
It determine RegExp.
(any)
Boolean
:
is.regexp(new RegExp); // => true
is('RegExp', /1/g); // => true
is('regexp', '/1/g'); // => false because it isn't RegExp
It determine object arguments.
(any)
Boolean
:
var args; // get object arguments
(function(){ args = arguments; })();
is.argument(args); // => true
is('argument', args); // => true
is('argument', []); // => false
It determine instance Symbol. (safety for es5)
(any)
Boolean
:
is.symbol(Symbol()); // => true
is('symbol', Symbol()); // => true
It determine instance Promise.
(any)
Boolean
:
is.promise(new Promise(function(){})); // => true
is('promise', q.defer().promise); // => true
is('promise', {then: function(){}}); // => true
It determine platform support for Symbol (save)
Boolean
:
is('support', 'symbol');
is.support('symbol');
is.support.symbol();
It determine platform support for Promise (save)
Boolean
:
is('support', 'promise');
is.support('promise');
is.support.promise();
It determine platform Node.js (save)
Boolean
:
is('platform', 'node'); // => true
is.platform('node'); // => true
is.platform.node(); // => true
It determine platform browser (save)
Boolean
:
is('platform', 'browser'); // => true
is.platform('browser'); // => true
is.platform.browser(); // => true
replace Object.assign
(Object)
count
Object
:
defination on platforms (both variants on platform like Electron)
bower i --save s-is
npm i --save s-is
window.is // in browser
var is = require('s-is') // in Node.js