Comparing version 3.3.7 to 3.3.9
492
index.js
@@ -8,48 +8,2 @@ 'use strict'; | ||
// src/function.coffee | ||
var isFunction; | ||
var isFunction$1 = isFunction = function(value) { | ||
var str; | ||
if (typeof window !== 'undefined' && value === window.alert) { | ||
return true; | ||
} | ||
str = toString(value); | ||
return str === '[object Function]' || str === '[object GeneratorFunction]' || str === '[object AsyncFunction]'; | ||
}; | ||
// src/type.coffee | ||
var isType; | ||
var type = isType = function(value, type) { | ||
return typeof value === type; | ||
}; | ||
// src/defined.coffee | ||
var isDefined; | ||
var defined = isDefined = function(value) { | ||
return typeof value !== 'undefined'; | ||
}; | ||
// src/empty.coffee | ||
var isEmpty; | ||
var empty = isEmpty = function(value) { | ||
var key, type; | ||
type = toString(value); | ||
if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') { | ||
return value.length === 0; | ||
} | ||
if (type === '[object Object]') { | ||
for (key in value) { | ||
if (hasOwn(value, key)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
return !value; | ||
}; | ||
// src/bool.coffee | ||
@@ -90,2 +44,14 @@ var isBool; | ||
// src/function.coffee | ||
var isFunction; | ||
var isFunction$1 = isFunction = function(value) { | ||
var str; | ||
if (typeof window !== 'undefined' && value === window.alert) { | ||
return true; | ||
} | ||
str = toString(value); | ||
return str === '[object Function]' || str === '[object GeneratorFunction]' || str === '[object AsyncFunction]'; | ||
}; | ||
// src/object.coffee | ||
@@ -108,2 +74,70 @@ var isObject; | ||
// src/async-function.coffee | ||
var isAsyncFunction; | ||
var asyncFunction = isAsyncFunction = function(value) { | ||
return toString(value) === '[object AsyncFunction]'; | ||
}; | ||
// src/string.coffee | ||
var isString; | ||
var isString$1 = isString = function(value) { | ||
return toString(value) === '[object String]'; | ||
}; | ||
// src/base64.coffee | ||
var base64Regex; | ||
var isBase64; | ||
base64Regex = /^([A-Za-z0-9+\/]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/; | ||
var base64 = isBase64 = function(value) { | ||
return isString$1(value) && (!value.length || base64Regex.test(value)); | ||
}; | ||
// src/date.coffee | ||
var isDate; | ||
var isDate$1 = isDate = function(value) { | ||
return toString(value) === '[object Date]'; | ||
}; | ||
// src/utils.coffee | ||
var isActualNaN = function(value) { | ||
return value !== value; | ||
}; | ||
// src/decimal.coffee | ||
var isDecimal; | ||
var decimal = isDecimal = function(value) { | ||
return isNumber$1(value) && !isActualNaN(value) && !isInfinite$1(value) && value % 1 !== 0; | ||
}; | ||
// src/defined.coffee | ||
var isDefined; | ||
var defined = isDefined = function(value) { | ||
return typeof value !== 'undefined'; | ||
}; | ||
// src/divisible-by.coffee | ||
var isDivisibleBy; | ||
var divisibleBy = isDivisibleBy = function(value, n) { | ||
var isDividendInfinite, isDivisorInfinite, isNonZeroNumber; | ||
isDividendInfinite = isInfinite$1(value); | ||
isDivisorInfinite = isInfinite$1(n); | ||
isNonZeroNumber = isNumber$1(value) && !isActualNaN(value) && isNumber$1(n) && !isActualNaN(n) && n !== 0; | ||
return isDividendInfinite || isDivisorInfinite || isNonZeroNumber && value % n === 0; | ||
}; | ||
// src/element.coffee | ||
var isElement; | ||
var element = isElement = function(value) { | ||
return value !== void 0 && typeof HTMLElement !== 'undefined' && value instanceof HTMLElement && value.nodeType === 1; | ||
}; | ||
// src/empty-arguments.coffee | ||
@@ -123,2 +157,22 @@ var isEmptyArguments; | ||
// src/empty.coffee | ||
var isEmpty; | ||
var empty = isEmpty = function(value) { | ||
var key, type; | ||
type = toString(value); | ||
if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') { | ||
return value.length === 0; | ||
} | ||
if (type === '[object Object]') { | ||
for (key in value) { | ||
if (hasOwn(value, key)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
return !value; | ||
}; | ||
// src/equal.coffee | ||
@@ -170,44 +224,16 @@ var isEqual; | ||
// src/hosted.coffee | ||
var NON_HOST_TYPES; | ||
var isHosted; | ||
// src/error.coffee | ||
var isError; | ||
NON_HOST_TYPES = { | ||
'boolean': 1, | ||
number: 1, | ||
string: 1, | ||
undefined: 1 | ||
var error = isError = function(value) { | ||
return toString(value) === '[object Error]'; | ||
}; | ||
var hosted = isHosted = function(value, host) { | ||
var type; | ||
type = typeof host[value]; | ||
if (type === 'object') { | ||
return !!host[value]; | ||
} else { | ||
return !NON_HOST_TYPES[type]; | ||
} | ||
}; | ||
// src/even.coffee | ||
var isEven; | ||
// src/instanceof.coffee | ||
var isInstanceOf; | ||
var _instanceof = isInstanceOf = function(value, constructor) { | ||
return value instanceof constructor; | ||
var even = isEven = function(value) { | ||
return isInfinite$1(value) || isNumber$1(value) && value === value && value % 2 === 0; | ||
}; | ||
// src/null.coffee | ||
var isNull; | ||
var _null = isNull = function(value) { | ||
return value === null; | ||
}; | ||
// src/undefined.coffee | ||
var isUndefined; | ||
var _undefined = isUndefined = function(value) { | ||
return typeof value === 'undefined'; | ||
}; | ||
// src/false.coffee | ||
@@ -220,58 +246,79 @@ var isFalse; | ||
// src/true.coffee | ||
var isTrue; | ||
// src/generator-function.coffee | ||
var isGeneratorFunction; | ||
var _true = isTrue = function(value) { | ||
return isBool$1(value) && Boolean(Number(value)) === true; | ||
var generatorFunction = isGeneratorFunction = function(value) { | ||
return toString(value) === '[object GeneratorFunction]'; | ||
}; | ||
// src/date.coffee | ||
var isDate; | ||
// src/generator.coffee | ||
var isGenerator; | ||
var isDate$1 = isDate = function(value) { | ||
return toString(value) === '[object Date]'; | ||
var generator = isGenerator = function(value) { | ||
return (isFunction$1(typeof g !== "undefined" && g !== null ? g.next : void 0)) && (isFunction$1(g["throw"])); | ||
}; | ||
// src/valid-date.coffee | ||
var isValidDate; | ||
// src/ge.coffee | ||
var isGe; | ||
var validDate = isValidDate = function(value) { | ||
return isDate$1(value) && !isNaN(Number(value)); | ||
var ge = isGe = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value >= other; | ||
}; | ||
// src/element.coffee | ||
var isElement; | ||
// src/gt.coffee | ||
var isGt; | ||
var element = isElement = function(value) { | ||
return value !== void 0 && typeof HTMLElement !== 'undefined' && value instanceof HTMLElement && value.nodeType === 1; | ||
var gt = isGt = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value > other; | ||
}; | ||
// src/error.coffee | ||
var isError; | ||
// src/hash.coffee | ||
var isHash; | ||
var error = isError = function(value) { | ||
return toString(value) === '[object Error]'; | ||
var hash = isHash = function(value) { | ||
return isObject$1(value) && value.constructor === Object && !value.nodeType && !value.setInterval; | ||
}; | ||
// src/utils.coffee | ||
var isActualNaN = function(value) { | ||
return value !== value; | ||
// src/hex.coffee | ||
var hexRegex; | ||
var isHex; | ||
hexRegex = /^[A-Fa-f0-9]+$/; | ||
var hex = isHex = function(value) { | ||
return isString$1(value) && (!value.length || hexRegex.test(value)); | ||
}; | ||
// src/decimal.coffee | ||
var isDecimal; | ||
// src/hosted.coffee | ||
var NON_HOST_TYPES; | ||
var isHosted; | ||
var decimal = isDecimal = function(value) { | ||
return isNumber$1(value) && !isActualNaN(value) && !isInfinite$1(value) && value % 1 !== 0; | ||
NON_HOST_TYPES = { | ||
'boolean': 1, | ||
number: 1, | ||
string: 1, | ||
undefined: 1 | ||
}; | ||
// src/divisible-by.coffee | ||
var isDivisibleBy; | ||
var hosted = isHosted = function(value, host) { | ||
var type; | ||
type = typeof host[value]; | ||
if (type === 'object') { | ||
return !!host[value]; | ||
} else { | ||
return !NON_HOST_TYPES[type]; | ||
} | ||
}; | ||
var divisibleBy = isDivisibleBy = function(value, n) { | ||
var isDividendInfinite, isDivisorInfinite, isNonZeroNumber; | ||
isDividendInfinite = isInfinite$1(value); | ||
isDivisorInfinite = isInfinite$1(n); | ||
isNonZeroNumber = isNumber$1(value) && !isActualNaN(value) && isNumber$1(n) && !isActualNaN(n) && n !== 0; | ||
return isDividendInfinite || isDivisorInfinite || isNonZeroNumber && value % n === 0; | ||
// src/instanceof.coffee | ||
var isInstanceOf; | ||
var _instanceof = isInstanceOf = function(value, constructor) { | ||
return value instanceof constructor; | ||
}; | ||
@@ -286,2 +333,22 @@ | ||
// src/le.coffee | ||
var isLe; | ||
var le = isLe = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value <= other; | ||
}; | ||
// src/lt.coffee | ||
var isLt; | ||
var lt = isLt = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value < other; | ||
}; | ||
// src/max.coffee | ||
@@ -332,7 +399,7 @@ var isMax; | ||
// src/even.coffee | ||
var isEven; | ||
// src/null.coffee | ||
var isNull; | ||
var even = isEven = function(value) { | ||
return isInfinite$1(value) || isNumber$1(value) && value === value && value % 2 === 0; | ||
var _null = isNull = function(value) { | ||
return value === null; | ||
}; | ||
@@ -347,56 +414,2 @@ | ||
// src/ge.coffee | ||
var isGe; | ||
var ge = isGe = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value >= other; | ||
}; | ||
// src/gt.coffee | ||
var isGt; | ||
var gt = isGt = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value > other; | ||
}; | ||
// src/le.coffee | ||
var isLe; | ||
var le = isLe = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value <= other; | ||
}; | ||
// src/lt.coffee | ||
var isLt; | ||
var lt = isLt = function(value, other) { | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
return !isInfinite$1(value) && !isInfinite$1(other) && value < other; | ||
}; | ||
// src/within.coffee | ||
var isWithin; | ||
var within = isWithin = function(value, start, finish) { | ||
var isAnyInfinite; | ||
if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} else if (!isNumber$1(value) || !isNumber$1(start) || !isNumber$1(finish)) { | ||
throw new TypeError('all arguments must be numbers'); | ||
} | ||
isAnyInfinite = isInfinite$1(value) || isInfinite$1(start) || isInfinite$1(finish); | ||
return isAnyInfinite || value >= start && value <= finish; | ||
}; | ||
// src/primitive.coffee | ||
@@ -422,9 +435,2 @@ var isPrimitive; | ||
// src/hash.coffee | ||
var isHash; | ||
var hash = isHash = function(value) { | ||
return isObject$1(value) && value.constructor === Object && !value.nodeType && !value.setInterval; | ||
}; | ||
// src/regexp.coffee | ||
@@ -437,37 +443,52 @@ var isRegExp; | ||
// src/string.coffee | ||
var isString; | ||
// src/symbol.coffee | ||
var isSymbol; | ||
var symbolValueOf; | ||
var isString$1 = isString = function(value) { | ||
return toString(value) === '[object String]'; | ||
symbolValueOf = typeof Symbol === 'function' ? Symbol.prototype.valueOf : void 0; | ||
var symbol = isSymbol = function(value) { | ||
return typeof Symbol === 'function' && toString(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol'; | ||
}; | ||
// src/base64.coffee | ||
var base64Regex; | ||
var isBase64; | ||
// src/true.coffee | ||
var isTrue; | ||
base64Regex = /^([A-Za-z0-9+\/]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/; | ||
var _true = isTrue = function(value) { | ||
return isBool$1(value) && Boolean(Number(value)) === true; | ||
}; | ||
var base64 = isBase64 = function(value) { | ||
return isString$1(value) && (!value.length || base64Regex.test(value)); | ||
// src/type.coffee | ||
var isType; | ||
var type = isType = function(value, type) { | ||
return typeof value === type; | ||
}; | ||
// src/hex.coffee | ||
var hexRegex; | ||
var isHex; | ||
// src/undefined.coffee | ||
var isUndefined; | ||
hexRegex = /^[A-Fa-f0-9]+$/; | ||
var _undefined = isUndefined = function(value) { | ||
return typeof value === 'undefined'; | ||
}; | ||
var hex = isHex = function(value) { | ||
return isString$1(value) && (!value.length || hexRegex.test(value)); | ||
// src/valid-date.coffee | ||
var isValidDate; | ||
var validDate = isValidDate = function(value) { | ||
return isDate$1(value) && !isNaN(Number(value)); | ||
}; | ||
// src/symbol.coffee | ||
var isSymbol; | ||
var symbolValueOf; | ||
// src/within.coffee | ||
var isWithin; | ||
symbolValueOf = typeof Symbol === 'function' ? Symbol.prototype.valueOf : void 0; | ||
var symbol = isSymbol = function(value) { | ||
return typeof Symbol === 'function' && toString(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol'; | ||
var within = isWithin = function(value, start, finish) { | ||
var isAnyInfinite; | ||
if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) { | ||
throw new TypeError('NaN is not a valid value'); | ||
} else if (!isNumber$1(value) || !isNumber$1(start) || !isNumber$1(finish)) { | ||
throw new TypeError('all arguments must be numbers'); | ||
} | ||
isAnyInfinite = isInfinite$1(value) || isInfinite$1(start) || isInfinite$1(finish); | ||
return isAnyInfinite || value >= start && value <= finish; | ||
}; | ||
@@ -480,47 +501,50 @@ | ||
var es = Object.freeze({ | ||
isFunction: isFunction$1, | ||
isType: type, | ||
isDefined: defined, | ||
isEmpty: empty, | ||
isEmptyArguments: emptyArguments, | ||
isEmptyArray: emptyArray, | ||
isEqual: equal, | ||
isHosted: hosted, | ||
isInstanceOf: _instanceof, | ||
isNull: _null, | ||
isUndefined: _undefined, | ||
isArguments: isArguments$1, | ||
isArrayLike: isArrayLike$1, | ||
isArray: isArray$1, | ||
isArrayLike: isArrayLike$1, | ||
isAsyncFunction: asyncFunction, | ||
isBase64: base64, | ||
isBool: isBool$1, | ||
isFalse: _false, | ||
isTrue: _true, | ||
isDate: isDate$1, | ||
isValidDate: validDate, | ||
isDecimal: decimal, | ||
isDefined: defined, | ||
isDivisibleBy: divisibleBy, | ||
isElement: element, | ||
isEmptyArguments: emptyArguments, | ||
isEmptyArray: emptyArray, | ||
isEmpty: empty, | ||
isEqual: equal, | ||
isError: error, | ||
isNumber: isNumber$1, | ||
isEven: even, | ||
isFalse: _false, | ||
isFunction: isFunction$1, | ||
isGeneratorFunction: generatorFunction, | ||
isGenerator: generator, | ||
isGe: ge, | ||
isGt: gt, | ||
isHash: hash, | ||
isHex: hex, | ||
isHosted: hosted, | ||
isInfinite: isInfinite$1, | ||
isDecimal: decimal, | ||
isDivisibleBy: divisibleBy, | ||
isInstanceOf: _instanceof, | ||
isInteger: integer, | ||
isLe: le, | ||
isLt: lt, | ||
isMax: max, | ||
isMin: min, | ||
isNaN: nan, | ||
isEven: even, | ||
isNull: _null, | ||
isNumber: isNumber$1, | ||
isObject: isObject$1, | ||
isOdd: odd, | ||
isGe: ge, | ||
isGt: gt, | ||
isLe: le, | ||
isLt: lt, | ||
isWithin: within, | ||
isObject: isObject$1, | ||
isPrimitive: primitive, | ||
isPromise: promise, | ||
isHash: hash, | ||
isRegExp: regexp, | ||
isString: isString$1, | ||
isBase64: base64, | ||
isHex: hex, | ||
isSymbol: symbol | ||
isSymbol: symbol, | ||
isTrue: _true, | ||
isType: type, | ||
isUndefined: _undefined, | ||
isValidDate: validDate, | ||
isWithin: within | ||
}); | ||
@@ -527,0 +551,0 @@ |
{ | ||
"name": "es-is", | ||
"version": "3.3.7", | ||
"version": "3.3.9", | ||
"main": "index.js", | ||
@@ -13,3 +13,5 @@ "module": "index.mjs", | ||
"scripts": { | ||
"build": "sake build", | ||
"prepublishOnly": "sake build", | ||
"pretest": "sake build", | ||
"test": "sake test" | ||
@@ -31,3 +33,3 @@ }, | ||
"dependencies": { | ||
"es-hasown": "0.1.0", | ||
"es-hasown": "0.1.1", | ||
"es-tostring": "0.1.0" | ||
@@ -34,0 +36,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
157
1148
119952
+ Addedes-hasown@0.1.1(transitive)
- Removedes-hasown@0.1.0(transitive)
Updatedes-hasown@0.1.1