@pluginjs/is
Advanced tools
Comparing version 0.2.11 to 0.2.13
365
dist/is.js
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global['@pluginjs/is'] = {}))); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global['@pluginjs/is'] = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
/*eslint-disable */ | ||
/* Credit to http://is.js.org MIT */ | ||
var toString = Object.prototype.toString; | ||
var is = { | ||
// Type checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value Arguments? | ||
arguments: function _arguments(value) { | ||
// fallback check is for IE | ||
return toString.call(value) === '[object Arguments]' || value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'callee' in value; | ||
}, | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
// is a given value Array? | ||
array: function array(val) { | ||
if (Array.isArray) { | ||
return Array.isArray(val); | ||
} | ||
} | ||
return toString.call(val) === '[object Array]'; | ||
}, | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
// is a given value Boolean? | ||
boolean: function boolean(val) { | ||
return val === true || val === false || toString.call(val) === '[object Boolean]'; | ||
}, | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
// is a given value Char? | ||
char: function char(val) { | ||
return this.string(val) && val.length === 1; | ||
}, | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
// is a given value Date Object? | ||
date: function date(value) { | ||
return toString.call(value) === '[object Date]'; | ||
}, | ||
front = front.next; | ||
// is a given object a DOM node? | ||
domNode: function domNode(object) { | ||
return this.object(object) && object.nodeType > 0; | ||
}, | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
// is a given value Error object? | ||
error: function error(val) { | ||
return toString.call(val) === '[object Error]'; | ||
}, | ||
this._invoke = send; | ||
// is a given value function? | ||
function: function _function(val) { | ||
// fallback check is for IE | ||
return toString.call(val) === '[object Function]' || typeof val === 'function'; | ||
}, | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
// is given value a pure JSON object? | ||
json: function json(value) { | ||
return toString.call(value) === '[object Object]'; | ||
}, | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
// is a given value NaN? | ||
nan: function nan(val) { | ||
// NaN is number :) Also it is the only value which does not equal itself | ||
return val !== val; | ||
}, | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
// is a given value null? | ||
null: function _null(val) { | ||
return val === null; | ||
}, | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
// is a given value number? | ||
number: function number(val) { | ||
return !this.nan(val) && toString.call(val) === '[object Number]'; | ||
}, | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
// is a given value object? | ||
object: function object(val) { | ||
return Object(val) === val; | ||
}, | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
// is a given value empty object? | ||
emptyObject: function emptyObject(val) { | ||
return this.object(val) && Object.getOwnPropertyNames(val).length == 0; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
/*eslint-disable */ | ||
/* Credit to http://is.js.org MIT */ | ||
var toString = Object.prototype.toString; | ||
var is = { | ||
// Type checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value Arguments? | ||
arguments: function _arguments(value) { | ||
// fallback check is for IE | ||
return toString.call(value) === '[object Arguments]' || value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'callee' in value; | ||
}, | ||
// is a given value RegExp? | ||
regexp: function regexp(val) { | ||
return toString.call(val) === '[object RegExp]'; | ||
}, | ||
// is a given value Array? | ||
array: function array(val) { | ||
if (Array.isArray) { | ||
return Array.isArray(val); | ||
} | ||
return toString.call(val) === '[object Array]'; | ||
}, | ||
// is a given value String? | ||
string: function string(val) { | ||
return typeof val === 'string' || toString.call(val) === '[object String]'; | ||
}, | ||
// is a given value Boolean? | ||
boolean: function boolean(val) { | ||
return val === true || val === false || toString.call(val) === '[object Boolean]'; | ||
}, | ||
// is a given value undefined? | ||
undefined: function undefined(val) { | ||
return val === void 0; | ||
}, | ||
// is a given value Char? | ||
char: function char(val) { | ||
return this.string(val) && val.length === 1; | ||
}, | ||
// Arithmetic checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value numeric? | ||
numeric: function numeric(n) { | ||
return (this.number(n) || this.string(n)) && !this.nan(n - parseFloat(n)); | ||
}, | ||
// is a given value Date Object? | ||
date: function date(value) { | ||
return toString.call(value) === '[object Date]'; | ||
}, | ||
// is a given number percentage? | ||
percentage: function percentage(n) { | ||
return typeof n === 'string' && n.indexOf('%') !== -1; | ||
}, | ||
// is a given object a DOM node? | ||
domNode: function domNode(object) { | ||
return this.object(object) && object.nodeType > 0; | ||
}, | ||
// is a given number decimal? | ||
decimal: function decimal(n) { | ||
return this.number(n) && n % 1 !== 0; | ||
}, | ||
// is a given value Error object? | ||
error: function error(val) { | ||
return toString.call(val) === '[object Error]'; | ||
}, | ||
// is a given number finite? | ||
finite: function finite(n) { | ||
if (isFinite) { | ||
return isFinite(n); | ||
} | ||
return !this.infinite(n) && !this.nan(n); | ||
}, | ||
// is a given value function? | ||
function: function _function(val) { | ||
// fallback check is for IE | ||
return toString.call(val) === '[object Function]' || typeof val === 'function'; | ||
}, | ||
// is a given number infinite? | ||
infinite: function infinite(n) { | ||
return n === Infinity || n === -Infinity; | ||
}, | ||
// is given value a pure JSON object? | ||
json: function json(value) { | ||
return toString.call(value) === '[object Object]'; | ||
}, | ||
integer: function integer(n) { | ||
return this.number(n) && n % 1 === 0; | ||
}, | ||
// is a given value NaN? | ||
nan: function nan(val) { | ||
// NaN is number :) Also it is the only value which does not equal itself | ||
return val !== val; | ||
}, | ||
// is a given number negative? | ||
negative: function negative(n) { | ||
return this.number(n) && n < 0; | ||
}, | ||
// is a given value null? | ||
null: function _null(val) { | ||
return val === null; | ||
}, | ||
// is a given value number? | ||
number: function number(val) { | ||
return !this.nan(val) && toString.call(val) === '[object Number]'; | ||
}, | ||
// is a given value object? | ||
object: function object(val) { | ||
return Object(val) === val; | ||
}, | ||
// is a given value empty object? | ||
emptyObject: function emptyObject(val) { | ||
return this.object(val) && Object.getOwnPropertyNames(val).length == 0; | ||
}, | ||
// is a given value RegExp? | ||
regexp: function regexp(val) { | ||
return toString.call(val) === '[object RegExp]'; | ||
}, | ||
// is a given value String? | ||
string: function string(val) { | ||
return typeof val === 'string' || toString.call(val) === '[object String]'; | ||
}, | ||
// is a given value undefined? | ||
undefined: function undefined(val) { | ||
return val === void 0; | ||
}, | ||
// Arithmetic checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value numeric? | ||
numeric: function numeric(n) { | ||
return (this.number(n) || this.string(n)) && !this.nan(n - parseFloat(n)); | ||
}, | ||
// is a given number percentage? | ||
percentage: function percentage(n) { | ||
return typeof n === 'string' && n.indexOf('%') !== -1; | ||
}, | ||
// is a given number decimal? | ||
decimal: function decimal(n) { | ||
return this.number(n) && n % 1 !== 0; | ||
}, | ||
// is a given number finite? | ||
finite: function finite(n) { | ||
if (isFinite) { | ||
return isFinite(n); | ||
// is a given number positive? | ||
positive: function positive(n) { | ||
return this.number(n) && n > 0; | ||
} | ||
return !this.infinite(n) && !this.nan(n); | ||
}, | ||
}; | ||
// is a given number infinite? | ||
infinite: function infinite(n) { | ||
return n === Infinity || n === -Infinity; | ||
}, | ||
exports.default = is; | ||
integer: function integer(n) { | ||
return this.number(n) && n % 1 === 0; | ||
}, | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
// is a given number negative? | ||
negative: function negative(n) { | ||
return this.number(n) && n < 0; | ||
}, | ||
// is a given number positive? | ||
positive: function positive(n) { | ||
return this.number(n) && n > 0; | ||
} | ||
}; | ||
exports['default'] = is; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n["@pluginjs/is"]={})}(this,function(n){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e=(function(){function n(n){this.value=n}function t(t){function e(o,i){try{var u=t[o](i),c=u.value;c instanceof n?Promise.resolve(c.value).then(function(n){e("next",n)},function(n){e("throw",n)}):r(u.done?"return":"normal",u.value)}catch(n){r("throw",n)}}function r(n,t){switch(n){case"return":o.resolve({value:t,done:!0});break;case"throw":o.reject(t);break;default:o.resolve({value:t,done:!1})}(o=o.next)?e(o.key,o.arg):i=null}var o,i;this._invoke=function(n,t){return new Promise(function(r,u){var c={key:n,arg:t,resolve:r,reject:u,next:null};i?i=i.next=c:(o=i=c,e(n,t))})},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(n){return this._invoke("next",n)},t.prototype.throw=function(n){return this._invoke("throw",n)},t.prototype.return=function(n){return this._invoke("return",n)}}(),Object.prototype.toString),r={arguments:function(n){return"[object Arguments]"===e.call(n)||null!=n&&"object"===(void 0===n?"undefined":t(n))&&"callee"in n},array:function(n){return Array.isArray?Array.isArray(n):"[object Array]"===e.call(n)},boolean:function(n){return!0===n||!1===n||"[object Boolean]"===e.call(n)},char:function(n){return this.string(n)&&1===n.length},date:function(n){return"[object Date]"===e.call(n)},domNode:function(n){return this.object(n)&&n.nodeType>0},error:function(n){return"[object Error]"===e.call(n)},function:function(n){return"[object Function]"===e.call(n)||"function"==typeof n},json:function(n){return"[object Object]"===e.call(n)},nan:function(n){return n!=n},null:function(n){return null===n},number:function(n){return!this.nan(n)&&"[object Number]"===e.call(n)},object:function(n){return Object(n)===n},emptyObject:function(n){return this.object(n)&&0==Object.getOwnPropertyNames(n).length},regexp:function(n){return"[object RegExp]"===e.call(n)},string:function(n){return"string"==typeof n||"[object String]"===e.call(n)},undefined:function(n){return void 0===n},numeric:function(n){return(this.number(n)||this.string(n))&&!this.nan(n-parseFloat(n))},percentage:function(n){return"string"==typeof n&&-1!==n.indexOf("%")},decimal:function(n){return this.number(n)&&n%1!=0},finite:function(n){return isFinite?isFinite(n):!this.infinite(n)&&!this.nan(n)},infinite:function(n){return n===1/0||n===-1/0},integer:function(n){return this.number(n)&&n%1==0},negative:function(n){return this.number(n)&&n<0},positive:function(n){return this.number(n)&&n>0}};n.default=r,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n["@pluginjs/is"]={})}(this,function(n){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e=Object.prototype.toString,r={arguments:function(n){return"[object Arguments]"===e.call(n)||null!=n&&"object"===(void 0===n?"undefined":t(n))&&"callee"in n},array:function(n){return Array.isArray?Array.isArray(n):"[object Array]"===e.call(n)},boolean:function(n){return!0===n||!1===n||"[object Boolean]"===e.call(n)},char:function(n){return this.string(n)&&1===n.length},date:function(n){return"[object Date]"===e.call(n)},domNode:function(n){return this.object(n)&&n.nodeType>0},error:function(n){return"[object Error]"===e.call(n)},function:function(n){return"[object Function]"===e.call(n)||"function"==typeof n},json:function(n){return"[object Object]"===e.call(n)},nan:function(n){return n!=n},null:function(n){return null===n},number:function(n){return!this.nan(n)&&"[object Number]"===e.call(n)},object:function(n){return Object(n)===n},emptyObject:function(n){return this.object(n)&&0==Object.getOwnPropertyNames(n).length},regexp:function(n){return"[object RegExp]"===e.call(n)},string:function(n){return"string"==typeof n||"[object String]"===e.call(n)},undefined:function(n){return void 0===n},numeric:function(n){return(this.number(n)||this.string(n))&&!this.nan(n-parseFloat(n))},percentage:function(n){return"string"==typeof n&&-1!==n.indexOf("%")},decimal:function(n){return this.number(n)&&n%1!=0},finite:function(n){return isFinite?isFinite(n):!this.infinite(n)&&!this.nan(n)},infinite:function(n){return n===1/0||n===-1/0},integer:function(n){return this.number(n)&&n%1==0},negative:function(n){return this.number(n)&&n<0},positive:function(n){return this.number(n)&&n>0}};n.default=r,Object.defineProperty(n,"__esModule",{value:!0})}); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global['@pluginjs/is'] = {}))); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global['@pluginjs/is'] = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
/*eslint-disable */ | ||
/* Credit to http://is.js.org MIT */ | ||
var toString = Object.prototype.toString; | ||
var is = { | ||
// Type checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value Arguments? | ||
arguments: function _arguments(value) { | ||
// fallback check is for IE | ||
return toString.call(value) === '[object Arguments]' || value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'callee' in value; | ||
}, | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
// is a given value Array? | ||
array: function array(val) { | ||
if (Array.isArray) { | ||
return Array.isArray(val); | ||
} | ||
} | ||
return toString.call(val) === '[object Array]'; | ||
}, | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
// is a given value Boolean? | ||
boolean: function boolean(val) { | ||
return val === true || val === false || toString.call(val) === '[object Boolean]'; | ||
}, | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
// is a given value Char? | ||
char: function char(val) { | ||
return this.string(val) && val.length === 1; | ||
}, | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
// is a given value Date Object? | ||
date: function date(value) { | ||
return toString.call(value) === '[object Date]'; | ||
}, | ||
front = front.next; | ||
// is a given object a DOM node? | ||
domNode: function domNode(object) { | ||
return this.object(object) && object.nodeType > 0; | ||
}, | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
// is a given value Error object? | ||
error: function error(val) { | ||
return toString.call(val) === '[object Error]'; | ||
}, | ||
this._invoke = send; | ||
// is a given value function? | ||
function: function _function(val) { | ||
// fallback check is for IE | ||
return toString.call(val) === '[object Function]' || typeof val === 'function'; | ||
}, | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
// is given value a pure JSON object? | ||
json: function json(value) { | ||
return toString.call(value) === '[object Object]'; | ||
}, | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
// is a given value NaN? | ||
nan: function nan(val) { | ||
// NaN is number :) Also it is the only value which does not equal itself | ||
return val !== val; | ||
}, | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
// is a given value null? | ||
null: function _null(val) { | ||
return val === null; | ||
}, | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
// is a given value number? | ||
number: function number(val) { | ||
return !this.nan(val) && toString.call(val) === '[object Number]'; | ||
}, | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
// is a given value object? | ||
object: function object(val) { | ||
return Object(val) === val; | ||
}, | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
// is a given value empty object? | ||
emptyObject: function emptyObject(val) { | ||
return this.object(val) && Object.getOwnPropertyNames(val).length == 0; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
/*eslint-disable */ | ||
/* Credit to http://is.js.org MIT */ | ||
var toString = Object.prototype.toString; | ||
var is = { | ||
// Type checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value Arguments? | ||
arguments: function _arguments(value) { | ||
// fallback check is for IE | ||
return toString.call(value) === '[object Arguments]' || value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'callee' in value; | ||
}, | ||
// is a given value RegExp? | ||
regexp: function regexp(val) { | ||
return toString.call(val) === '[object RegExp]'; | ||
}, | ||
// is a given value Array? | ||
array: function array(val) { | ||
if (Array.isArray) { | ||
return Array.isArray(val); | ||
} | ||
return toString.call(val) === '[object Array]'; | ||
}, | ||
// is a given value String? | ||
string: function string(val) { | ||
return typeof val === 'string' || toString.call(val) === '[object String]'; | ||
}, | ||
// is a given value Boolean? | ||
boolean: function boolean(val) { | ||
return val === true || val === false || toString.call(val) === '[object Boolean]'; | ||
}, | ||
// is a given value undefined? | ||
undefined: function undefined(val) { | ||
return val === void 0; | ||
}, | ||
// is a given value Char? | ||
char: function char(val) { | ||
return this.string(val) && val.length === 1; | ||
}, | ||
// Arithmetic checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value numeric? | ||
numeric: function numeric(n) { | ||
return (this.number(n) || this.string(n)) && !this.nan(n - parseFloat(n)); | ||
}, | ||
// is a given value Date Object? | ||
date: function date(value) { | ||
return toString.call(value) === '[object Date]'; | ||
}, | ||
// is a given number percentage? | ||
percentage: function percentage(n) { | ||
return typeof n === 'string' && n.indexOf('%') !== -1; | ||
}, | ||
// is a given object a DOM node? | ||
domNode: function domNode(object) { | ||
return this.object(object) && object.nodeType > 0; | ||
}, | ||
// is a given number decimal? | ||
decimal: function decimal(n) { | ||
return this.number(n) && n % 1 !== 0; | ||
}, | ||
// is a given value Error object? | ||
error: function error(val) { | ||
return toString.call(val) === '[object Error]'; | ||
}, | ||
// is a given number finite? | ||
finite: function finite(n) { | ||
if (isFinite) { | ||
return isFinite(n); | ||
} | ||
return !this.infinite(n) && !this.nan(n); | ||
}, | ||
// is a given value function? | ||
function: function _function(val) { | ||
// fallback check is for IE | ||
return toString.call(val) === '[object Function]' || typeof val === 'function'; | ||
}, | ||
// is a given number infinite? | ||
infinite: function infinite(n) { | ||
return n === Infinity || n === -Infinity; | ||
}, | ||
// is given value a pure JSON object? | ||
json: function json(value) { | ||
return toString.call(value) === '[object Object]'; | ||
}, | ||
integer: function integer(n) { | ||
return this.number(n) && n % 1 === 0; | ||
}, | ||
// is a given value NaN? | ||
nan: function nan(val) { | ||
// NaN is number :) Also it is the only value which does not equal itself | ||
return val !== val; | ||
}, | ||
// is a given number negative? | ||
negative: function negative(n) { | ||
return this.number(n) && n < 0; | ||
}, | ||
// is a given value null? | ||
null: function _null(val) { | ||
return val === null; | ||
}, | ||
// is a given value number? | ||
number: function number(val) { | ||
return !this.nan(val) && toString.call(val) === '[object Number]'; | ||
}, | ||
// is a given value object? | ||
object: function object(val) { | ||
return Object(val) === val; | ||
}, | ||
// is a given value empty object? | ||
emptyObject: function emptyObject(val) { | ||
return this.object(val) && Object.getOwnPropertyNames(val).length == 0; | ||
}, | ||
// is a given value RegExp? | ||
regexp: function regexp(val) { | ||
return toString.call(val) === '[object RegExp]'; | ||
}, | ||
// is a given value String? | ||
string: function string(val) { | ||
return typeof val === 'string' || toString.call(val) === '[object String]'; | ||
}, | ||
// is a given value undefined? | ||
undefined: function undefined(val) { | ||
return val === void 0; | ||
}, | ||
// Arithmetic checks | ||
/* -------------------------------------------------------------------------- */ | ||
// is a given value numeric? | ||
numeric: function numeric(n) { | ||
return (this.number(n) || this.string(n)) && !this.nan(n - parseFloat(n)); | ||
}, | ||
// is a given number percentage? | ||
percentage: function percentage(n) { | ||
return typeof n === 'string' && n.indexOf('%') !== -1; | ||
}, | ||
// is a given number decimal? | ||
decimal: function decimal(n) { | ||
return this.number(n) && n % 1 !== 0; | ||
}, | ||
// is a given number finite? | ||
finite: function finite(n) { | ||
if (isFinite) { | ||
return isFinite(n); | ||
// is a given number positive? | ||
positive: function positive(n) { | ||
return this.number(n) && n > 0; | ||
} | ||
return !this.infinite(n) && !this.nan(n); | ||
}, | ||
}; | ||
// is a given number infinite? | ||
infinite: function infinite(n) { | ||
return n === Infinity || n === -Infinity; | ||
}, | ||
exports.default = is; | ||
integer: function integer(n) { | ||
return this.number(n) && n % 1 === 0; | ||
}, | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
// is a given number negative? | ||
negative: function negative(n) { | ||
return this.number(n) && n < 0; | ||
}, | ||
// is a given number positive? | ||
positive: function positive(n) { | ||
return this.number(n) && n > 0; | ||
} | ||
}; | ||
exports['default'] = is; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); |
{ | ||
"name": "@pluginjs/is", | ||
"title": "Plugin", | ||
"version": "0.2.11", | ||
"version": "0.2.13", | ||
"description": "A workflow for modern frontend development.", | ||
@@ -6,0 +6,0 @@ "author": "Creation Studio Limited", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19498
511