to-length-x
Advanced tools
Comparing version 2.1.0 to 3.0.0
76
index.js
/** | ||
* @file ES6-compliant shim for ToLength. | ||
* @file Shim for ToLength. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tolength|7.1.15 ToLength ( argument )} | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -13,20 +13,9 @@ * @copyright Xotic750 | ||
var toInteger = require('to-integer-x'); | ||
var libToInteger = require('to-integer-x'); | ||
var toInteger2016 = libToInteger.toInteger2016; | ||
var toInteger2018 = libToInteger.toInteger2018; | ||
var MAX_SAFE_INTEGER = require('max-safe-integer'); | ||
/** | ||
* Converts `value` to an integer suitable for use as the length of an | ||
* array-like object. | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
* var toLength = require('to-length-x'); | ||
* toLength(3); // 3 | ||
* toLength(Number.MIN_VALUE); // 0 | ||
* toLength(Infinity); // Number.MAX_SAFE_INTEGER | ||
* toLength('3'); // 3 | ||
*/ | ||
module.exports = function toLength(value) { | ||
var len = toInteger(value); | ||
var $toLength2016 = function toLength2016(value) { | ||
var len = toInteger2016(value); | ||
// includes converting -0 to +0 | ||
@@ -43,1 +32,52 @@ if (len <= 0) { | ||
}; | ||
var $toLength2018 = function toLength2018(value) { | ||
var len = toInteger2018(value); | ||
// includes converting -0 to +0 | ||
if (len <= 0) { | ||
return 0; | ||
} | ||
if (len > MAX_SAFE_INTEGER) { | ||
return MAX_SAFE_INTEGER; | ||
} | ||
return len; | ||
}; | ||
module.exports = { | ||
/** | ||
* Reference to toLength2018. | ||
*/ | ||
toLength: $toLength2018, | ||
/** | ||
* Converts `value` to an integer suitable for use as the length of an | ||
* array-like object. (ES2016) | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
* var toLength = require('to-length-x').toLength2016; | ||
* toLength(3); // 3 | ||
* toLength(Number.MIN_VALUE); // 0 | ||
* toLength(Infinity); // Number.MAX_SAFE_INTEGER | ||
* toLength('3'); // 3 | ||
*/ | ||
toLength2016: $toLength2016, | ||
/** | ||
* Converts `value` to an integer suitable for use as the length of an | ||
* array-like object. (ES2018) | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
* var toLength = require('to-length-x').toLength2018; | ||
* toLength(3); // 3 | ||
* toLength(Number.MIN_VALUE); // 0 | ||
* toLength(Infinity); // Number.MAX_SAFE_INTEGER | ||
* toLength('3'); // 3 | ||
*/ | ||
toLength2018: $toLength2018 | ||
}; |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.returnExports = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
/** | ||
* @file ES6-compliant shim for ToLength. | ||
* @file Shim for ToLength. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tolength|7.1.15 ToLength ( argument )} | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -14,20 +14,9 @@ * @copyright Xotic750 | ||
var toInteger = _dereq_('to-integer-x'); | ||
var libToInteger = _dereq_('to-integer-x'); | ||
var toInteger2016 = libToInteger.toInteger2016; | ||
var toInteger2018 = libToInteger.toInteger2018; | ||
var MAX_SAFE_INTEGER = _dereq_('max-safe-integer'); | ||
/** | ||
* Converts `value` to an integer suitable for use as the length of an | ||
* array-like object. | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
* var toLength = require('to-length-x'); | ||
* toLength(3); // 3 | ||
* toLength(Number.MIN_VALUE); // 0 | ||
* toLength(Infinity); // Number.MAX_SAFE_INTEGER | ||
* toLength('3'); // 3 | ||
*/ | ||
module.exports = function toLength(value) { | ||
var len = toInteger(value); | ||
var $toLength2016 = function toLength2016(value) { | ||
var len = toInteger2016(value); | ||
// includes converting -0 to +0 | ||
@@ -45,4 +34,168 @@ if (len <= 0) { | ||
},{"max-safe-integer":14,"to-integer-x":18}],2:[function(_dereq_,module,exports){ | ||
var $toLength2018 = function toLength2018(value) { | ||
var len = toInteger2018(value); | ||
// includes converting -0 to +0 | ||
if (len <= 0) { | ||
return 0; | ||
} | ||
if (len > MAX_SAFE_INTEGER) { | ||
return MAX_SAFE_INTEGER; | ||
} | ||
return len; | ||
}; | ||
module.exports = { | ||
/** | ||
* Reference to toLength2018. | ||
*/ | ||
toLength: $toLength2018, | ||
/** | ||
* Converts `value` to an integer suitable for use as the length of an | ||
* array-like object. (ES2016) | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
* var toLength = require('to-length-x').toLength2016; | ||
* toLength(3); // 3 | ||
* toLength(Number.MIN_VALUE); // 0 | ||
* toLength(Infinity); // Number.MAX_SAFE_INTEGER | ||
* toLength('3'); // 3 | ||
*/ | ||
toLength2016: $toLength2016, | ||
/** | ||
* Converts `value` to an integer suitable for use as the length of an | ||
* array-like object. (ES2018) | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
* var toLength = require('to-length-x').toLength2018; | ||
* toLength(3); // 3 | ||
* toLength(Number.MIN_VALUE); // 0 | ||
* toLength(Infinity); // Number.MAX_SAFE_INTEGER | ||
* toLength('3'); // 3 | ||
*/ | ||
toLength2018: $toLength2018 | ||
}; | ||
},{"max-safe-integer":17,"to-integer-x":25}],2:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Invokes function, returning an object of the results. | ||
* @version 1.1.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module attempt-x | ||
*/ | ||
'use strict'; | ||
var getArgs = function _getArgs(args) { | ||
var length = args.length >>> 0; | ||
var array = []; | ||
var argLength = length - 1; | ||
if (argLength < 1) { | ||
return array; | ||
} | ||
array.length = argLength; | ||
for (var index = 1; index < length; index += 1) { | ||
array[index - 1] = args[index]; | ||
} | ||
return array; | ||
}; | ||
/** | ||
* This method attempts to invoke the function, returning either the result or | ||
* the caught error object. Any additional arguments are provided to the | ||
* function when it's invoked. | ||
* | ||
* @param {Function} fn - The function to attempt. | ||
* @param {...*} [args] - The arguments to invoke the function with. | ||
* @returns {Object} Returns an object of the result. | ||
* @example | ||
* var attempt = require('attempt-x'); | ||
* | ||
* function thrower() { | ||
* throw new Error('Threw'); | ||
* } | ||
* | ||
* attempt(thrower, 1, 2); | ||
* // { | ||
* // threw: true, | ||
* // value: // Error('Threw') object | ||
* // } | ||
* | ||
* function sumArgs(a, b) { | ||
* return a + b; | ||
* } | ||
* | ||
* attempt(sumArgs, 1, 2); | ||
* // { | ||
* // threw: false, | ||
* // value: 3 | ||
* // } | ||
* | ||
* var thisArg = []; | ||
* function pusher(a, b) { | ||
* return this.push(a, b); | ||
* } | ||
* | ||
* attempt.call(thisArg, pusher, 1, 2); | ||
* // { | ||
* // threw: false, | ||
* // value: 2 | ||
* // } | ||
* // thisArg => [1, 2]; | ||
*/ | ||
module.exports = function attempt(fn) { | ||
try { | ||
return { | ||
threw: false, | ||
value: fn.apply(this, getArgs(arguments)) | ||
}; | ||
} catch (e) { | ||
return { | ||
threw: true, | ||
value: e | ||
}; | ||
} | ||
}; | ||
},{}],3:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Constructors cached from literals. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module cached-constructors-x | ||
*/ | ||
'use strict'; | ||
/** | ||
* Constructors cached from literals. | ||
* | ||
* @type Object | ||
* @example | ||
* var constructors = require('cached-constructors-x'); | ||
*/ | ||
module.exports = { | ||
Array: [].constructor, | ||
Boolean: true.constructor, | ||
Number: (0).constructor, | ||
Object: {}.constructor, | ||
RegExp: (/(?:)/).constructor, | ||
String: ''.constructor | ||
}; | ||
},{}],4:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Tests if ES6 Symbol is supported. | ||
@@ -66,3 +219,3 @@ * @version 1.4.1 | ||
},{}],3:[function(_dereq_,module,exports){ | ||
},{}],5:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -88,5 +241,30 @@ * @file Tests if ES6 @@toStringTag is supported. | ||
},{"has-symbol-support-x":2}],4:[function(_dereq_,module,exports){ | ||
},{"has-symbol-support-x":4}],6:[function(_dereq_,module,exports){ | ||
/** | ||
* @file The constant value Infinity. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module infinity-x | ||
*/ | ||
'use strict'; | ||
/** | ||
* The constant value Infinity derived mathematically by 1 / 0. | ||
* | ||
* @type number | ||
* @example | ||
* var INFINITY = require('infinity-x'); | ||
* | ||
* INFINITY === Infinity; // true | ||
* -INFINITY === -Infinity; // true | ||
* INFINITY === -Infinity; // false | ||
*/ | ||
module.exports = 1 / 0; | ||
},{}],7:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
var getDay = Date.prototype.getDay; | ||
@@ -111,7 +289,44 @@ var tryDateObject = function tryDateObject(value) { | ||
},{}],5:[function(_dereq_,module,exports){ | ||
},{}],8:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Test if a given value is falsey. | ||
* @version 1.0.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module is-falsey-x | ||
*/ | ||
'use strict'; | ||
var toBoolean = _dereq_('to-boolean-x'); | ||
/** | ||
* This method tests if a given value is falsey. | ||
* | ||
* @param {*} value - The value to test. | ||
* @returns {boolean} `true` if the value is falsey: otherwise `false`. | ||
* @example | ||
* var isFalsey = require('is-falsey-x'); | ||
* | ||
* isFalsey(); // true | ||
* isFalsey(0); // true | ||
* isFalsey(''); // true | ||
* isFalsey(false); // true | ||
* isFalsey(null); // true | ||
* | ||
* isFalsey(true); // false | ||
* isFalsey([]); // false | ||
* isFalsey(1); // false | ||
* isFalsey(function () {}); // false | ||
*/ | ||
module.exports = function isFalsey(value) { | ||
return toBoolean(value) === false; | ||
}; | ||
},{"to-boolean-x":24}],9:[function(_dereq_,module,exports){ | ||
/** | ||
* @file ES6-compliant shim for Number.isFinite. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-number.isfinite|20.1.2.2 Number.isFinite ( number )} | ||
* @version 3.0.1 | ||
* @version 3.0.2 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -126,4 +341,3 @@ * @copyright Xotic750 | ||
var numberIsNaN = _dereq_('is-nan-x'); | ||
var inf = 1 / 0; | ||
var negInf = 1 / -0; | ||
var INFINITY = _dereq_('infinity-x'); | ||
@@ -150,9 +364,9 @@ /** | ||
module.exports = function isFinite(number) { | ||
return typeof number === 'number' && numberIsNaN(number) === false && number !== inf && number !== negInf; | ||
return typeof number === 'number' && numberIsNaN(number) === false && number !== INFINITY && number !== -INFINITY; | ||
}; | ||
},{"is-nan-x":7}],6:[function(_dereq_,module,exports){ | ||
},{"infinity-x":6,"is-nan-x":11}],10:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Determine whether a given value is a function object. | ||
* @version 3.1.1 | ||
* @version 3.3.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -166,7 +380,10 @@ * @copyright Xotic750 | ||
var attempt = _dereq_('attempt-x'); | ||
var fToString = Function.prototype.toString; | ||
var toBoolean = _dereq_('to-boolean-x'); | ||
var isFalsey = _dereq_('is-falsey-x'); | ||
var toStringTag = _dereq_('to-string-tag-x'); | ||
var hasToStringTag = _dereq_('has-to-string-tag-x'); | ||
var isPrimitive = _dereq_('is-primitive'); | ||
var normalise = _dereq_('normalize-space-x'); | ||
var normalise = _dereq_('normalize-space-x').normalizeSpace; | ||
var deComment = _dereq_('replace-comments-x'); | ||
@@ -176,19 +393,18 @@ var funcTag = '[object Function]'; | ||
var asyncTag = '[object AsyncFunction]'; | ||
var ctrRx = /^class /; | ||
var test = ctrRx.test; | ||
var hasNativeClass = true; | ||
try { | ||
var hasNativeClass = attempt(function () { | ||
// eslint-disable-next-line no-new-func | ||
Function('"use strict"; return class My {};')(); | ||
} catch (ignore) { | ||
hasNativeClass = false; | ||
} | ||
return Function('"use strict"; return class My {};')(); | ||
}).threw === false; | ||
var ctrRx = /^class /; | ||
var testClassstring = function _testClassstring(value) { | ||
return test.call(ctrRx, normalise(deComment(fToString.call(value), ' '))); | ||
}; | ||
var isES6ClassFn = function isES6ClassFunc(value) { | ||
try { | ||
return ctrRx.test(normalise(deComment(fToString.call(value), ' '))); | ||
} catch (ignore) {} | ||
var result = attempt(testClassstring, value); | ||
// not a function | ||
return false; | ||
return result.threw === false && result.value; | ||
}; | ||
@@ -205,14 +421,8 @@ | ||
*/ | ||
var tryFuncToString = function funcToString(value, allowClass) { | ||
try { | ||
if (hasNativeClass && allowClass === false && isES6ClassFn(value)) { | ||
return false; | ||
} | ||
if (hasNativeClass && allowClass === false && isES6ClassFn(value)) { | ||
return false; | ||
} | ||
fToString.call(value); | ||
return true; | ||
} catch (ignore) {} | ||
return false; | ||
return attempt.call(value, fToString).threw === false; | ||
}; | ||
@@ -249,8 +459,7 @@ | ||
var allowClass = arguments.length > 0 ? Boolean(arguments[1]) : false; | ||
if (hasToStringTag) { | ||
return tryFuncToString(value, allowClass); | ||
return tryFuncToString(value, toBoolean(arguments[1])); | ||
} | ||
if (hasNativeClass && allowClass === false && isES6ClassFn(value)) { | ||
if (hasNativeClass && isFalsey(arguments[1]) && isES6ClassFn(value)) { | ||
return false; | ||
@@ -263,3 +472,3 @@ } | ||
},{"has-to-string-tag-x":3,"is-primitive":9,"normalize-space-x":15,"replace-comments-x":16,"to-string-tag-x":21}],7:[function(_dereq_,module,exports){ | ||
},{"attempt-x":2,"has-to-string-tag-x":5,"is-falsey-x":8,"is-primitive":13,"normalize-space-x":19,"replace-comments-x":21,"to-boolean-x":24,"to-string-tag-x":28}],11:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -309,3 +518,3 @@ * @file ES6-compliant shim for Number.isNaN - the global isNaN returns false positives. | ||
},{}],8:[function(_dereq_,module,exports){ | ||
},{}],12:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -341,3 +550,3 @@ * @file Checks if `value` is `null` or `undefined`. | ||
},{"lodash.isnull":12,"validate.io-undefined":26}],9:[function(_dereq_,module,exports){ | ||
},{"lodash.isnull":15,"validate.io-undefined":33}],13:[function(_dereq_,module,exports){ | ||
/*! | ||
@@ -357,28 +566,6 @@ * is-primitive <https://github.com/jonschlinkert/is-primitive> | ||
},{}],10:[function(_dereq_,module,exports){ | ||
},{}],14:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
var strValue = String.prototype.valueOf; | ||
var tryStringObject = function tryStringObject(value) { | ||
try { | ||
strValue.call(value); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
}; | ||
var toStr = Object.prototype.toString; | ||
var strClass = '[object String]'; | ||
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; | ||
module.exports = function isString(value) { | ||
if (typeof value === 'string') { return true; } | ||
if (typeof value !== 'object') { return false; } | ||
return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; | ||
}; | ||
},{}],11:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
var toStr = Object.prototype.toString; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; | ||
@@ -409,3 +596,3 @@ | ||
},{}],12:[function(_dereq_,module,exports){ | ||
},{}],15:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -442,7 +629,7 @@ * lodash 3.0.0 (Custom Build) <https://lodash.com/> | ||
},{}],13:[function(_dereq_,module,exports){ | ||
},{}],16:[function(_dereq_,module,exports){ | ||
/** | ||
* @file ES6-compliant shim for Math.sign. | ||
* @file Shim for Math.sign. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-math.sign|20.2.2.29 Math.sign(x)} | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -456,27 +643,9 @@ * @copyright Xotic750 | ||
var toNumber = _dereq_('to-number-x'); | ||
var libToNumber = _dereq_('to-number-x'); | ||
var toNumber2016 = libToNumber.toNumber2016; | ||
var toNumber2018 = libToNumber.toNumber2018; | ||
var numberIsNaN = _dereq_('is-nan-x'); | ||
/** | ||
* This method returns the sign of a number, indicating whether the number is positive, | ||
* negative or zero. | ||
* | ||
* @param {*} x - A number. | ||
* @returns {number} A number representing the sign of the given argument. If the argument | ||
* is a positive number, negative number, positive zero or negative zero, the function will | ||
* return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned. | ||
* @example | ||
* var mathSign = require('math-sign-x'); | ||
* | ||
* mathSign(3); // 1 | ||
* mathSign(-3); // -1 | ||
* mathSign('-3'); // -1 | ||
* mathSign(0); // 0 | ||
* mathSign(-0); // -0 | ||
* mathSign(NaN); // NaN | ||
* mathSign('foo'); // NaN | ||
* mathSign(); // NaN | ||
*/ | ||
module.exports = function sign(x) { | ||
var n = toNumber(x); | ||
var $sign2016 = function sign2016(x) { | ||
var n = toNumber2016(x); | ||
if (n === 0 || numberIsNaN(n)) { | ||
@@ -489,14 +658,74 @@ return n; | ||
},{"is-nan-x":7,"to-number-x":19}],14:[function(_dereq_,module,exports){ | ||
var $sign2018 = function sign2018(x) { | ||
var n = toNumber2018(x); | ||
if (n === 0 || numberIsNaN(n)) { | ||
return n; | ||
} | ||
return n > 0 ? 1 : -1; | ||
}; | ||
module.exports = { | ||
/** | ||
* Reference to sign2018. | ||
*/ | ||
sign: $sign2018, | ||
/** | ||
* This method returns the sign of a number, indicating whether the number is positive, | ||
* negative or zero. (ES2016) | ||
* | ||
* @param {*} x - A number. | ||
* @returns {number} A number representing the sign of the given argument. If the argument | ||
* is a positive number, negative number, positive zero or negative zero, the function will | ||
* return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned. | ||
* @example | ||
* var mathSign = require('math-sign-x').sign2016; | ||
* | ||
* mathSign(3); // 1 | ||
* mathSign(-3); // -1 | ||
* mathSign('-3'); // -1 | ||
* mathSign(0); // 0 | ||
* mathSign(-0); // -0 | ||
* mathSign(NaN); // NaN | ||
* mathSign('foo'); // NaN | ||
* mathSign(); // NaN | ||
*/ | ||
sign2016: $sign2016, | ||
/** | ||
* This method returns the sign of a number, indicating whether the number is positive, | ||
* negative or zero. (ES2018) | ||
* | ||
* @param {*} x - A number. | ||
* @returns {number} A number representing the sign of the given argument. If the argument | ||
* is a positive number, negative number, positive zero or negative zero, the function will | ||
* return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned. | ||
* @example | ||
* var mathSign = require('math-sign-x').sign2018; | ||
* | ||
* mathSign(3); // 1 | ||
* mathSign(-3); // -1 | ||
* mathSign('-3'); // -1 | ||
* mathSign(0); // 0 | ||
* mathSign(-0); // -0 | ||
* mathSign(NaN); // NaN | ||
* mathSign('foo'); // NaN | ||
* mathSign(); // NaN | ||
*/ | ||
sign2018: $sign2018 | ||
}; | ||
},{"is-nan-x":11,"to-number-x":26}],17:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
module.exports = 9007199254740991; | ||
},{}],15:[function(_dereq_,module,exports){ | ||
},{}],18:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Trims and replaces sequences of whitespace characters by a single space. | ||
* @version 1.3.3 | ||
* @file The constant NaN derived mathematically by 0 / 0. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module normalize-space-x | ||
* @module nan-x | ||
*/ | ||
@@ -506,25 +735,209 @@ | ||
var trim = _dereq_('trim-x'); | ||
var reNormalize = new RegExp('[' + _dereq_('white-space-x').string + ']+', 'g'); | ||
/** | ||
* This method strips leading and trailing white-space from a string, | ||
* replaces sequences of whitespace characters by a single space, | ||
* and returns the resulting string. | ||
* The constant NaN derived mathematically by 0 / 0. | ||
* | ||
* @param {string} string - The string to be normalized. | ||
* @returns {string} The normalized string. | ||
* @type number | ||
* @example | ||
* var normalizeSpace = require('normalize-space-x'); | ||
* var NAN = require('nan-x'); | ||
* | ||
* normalizeSpace(' \t\na \t\nb \t\n') === 'a b'; // true | ||
* NAN !== NAN; // true | ||
* NAN === NAN; // false | ||
*/ | ||
module.exports = function normalizeSpace(string) { | ||
return trim(string).replace(reNormalize, ' '); | ||
module.exports = 0 / 0; | ||
},{}],19:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Trims and replaces sequences of whitespace characters by a single space. | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module normalize-space-x | ||
*/ | ||
'use strict'; | ||
var libTrim = _dereq_('trim-x'); | ||
var trim2016 = libTrim.trim2016; | ||
var trim2018 = libTrim.trim2018; | ||
var Rx = _dereq_('cached-constructors-x').RegExp; | ||
var libWhiteSpace = _dereq_('white-space-x'); | ||
var reNormalize2016 = new Rx('[' + libWhiteSpace.string2016 + ']+', 'g'); | ||
var reNormalize2018 = new Rx('[' + libWhiteSpace.string2018 + ']+', 'g'); | ||
var replace = ''.replace; | ||
var $normalizeSpace2016 = function normalizeSpace2016(string) { | ||
return replace.call(trim2016(string), reNormalize2016, ' '); | ||
}; | ||
},{"trim-x":25,"white-space-x":27}],16:[function(_dereq_,module,exports){ | ||
var $normalizeSpace2018 = function normalizeSpace2018(string) { | ||
return replace.call(trim2018(string), reNormalize2018, ' '); | ||
}; | ||
module.exports = { | ||
/** | ||
* Reference to normalizeSpace2018. | ||
*/ | ||
normalizeSpace: $normalizeSpace2018, | ||
/** | ||
* This method strips leading and trailing white-space from a string, | ||
* replaces sequences of whitespace characters by a single space, | ||
* and returns the resulting string. (ES2016) | ||
* | ||
* @param {string} string - The string to be normalized. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The normalized string. | ||
* @example | ||
* var normalizeSpace = require('normalize-space-x'); | ||
* | ||
* normalizeSpace(' \t\na \t\nb \t\n') === 'a b'; // true | ||
*/ | ||
normalizeSpace2016: $normalizeSpace2016, | ||
/** | ||
* This method strips leading and trailing white-space from a string, | ||
* replaces sequences of whitespace characters by a single space, | ||
* and returns the resulting string. (ES2018) | ||
* | ||
* @param {string} string - The string to be normalized. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The normalized string. | ||
* @example | ||
* var normalizeSpace = require('normalize-space-x'); | ||
* | ||
* normalizeSpace(' \t\na \t\nb \t\n') === 'a b'; // true | ||
*/ | ||
normalizeSpace2018: $normalizeSpace2018 | ||
}; | ||
},{"cached-constructors-x":3,"trim-x":32,"white-space-x":34}],20:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Parses a string argument and returns an integer of the specified radix. | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module parse-int-x | ||
*/ | ||
'use strict'; | ||
var nativeParseInt = parseInt; | ||
var NAN = _dereq_('nan-x'); | ||
var toStr = _dereq_('to-string-x'); | ||
var trimLeft2016 = _dereq_('trim-left-x').trimLeft2016; | ||
var trimLeft2018 = _dereq_('trim-left-x').trimLeft2018; | ||
var chachedCtrs = _dereq_('cached-constructors-x'); | ||
var castNumber = chachedCtrs.Number; | ||
var charAt = chachedCtrs.String.prototype.charAt; | ||
var hexRegex = /^[-+]?0[xX]/; | ||
var test = hexRegex.test; | ||
var $parseInt2016 = function parseInt2016(string, radix) { | ||
var str = trimLeft2016(toStr(string)); | ||
return nativeParseInt(str, castNumber(radix) || (test.call(hexRegex, str) ? 16 : 10)); | ||
}; | ||
var $parseInt2018 = function parseInt2018(string, radix) { | ||
var str = trimLeft2018(toStr(string)); | ||
if (charAt.call(str, 0) === '\u180E') { | ||
return NAN; | ||
} | ||
return nativeParseInt(str, castNumber(radix) || (test.call(hexRegex, str) ? 16 : 10)); | ||
}; | ||
module.exports = { | ||
/** | ||
* Reference to parseInt2018. | ||
*/ | ||
parseInt: $parseInt2018, | ||
/** | ||
* This method parses a string argument and returns an integer of the specified | ||
* radix (the base in mathematical numeral systems). (ES2016) | ||
* | ||
* @param {string} string - The value to parse. If the string argument is not a | ||
* string, then it is converted to a string (using the ToString abstract | ||
* operation). Leading whitespace in the string argument is ignored. | ||
* @param {number} radix - An integer between 2 and 36 that represents the radix | ||
* (the base in mathematical numeral systems) of the above mentioned string. | ||
* Specify 10 for the decimal numeral system commonly used by humans. Always | ||
* specify this parameter to eliminate reader confusion and to guarantee | ||
* predictable behavior. Different implementations produce different results | ||
* when a radix is not specified, usually defaulting the value to 10. | ||
* @throws {TypeError} If target is a Symbol or is not coercible. | ||
* @returns {number} An integer number parsed from the given string. If the first | ||
* character cannot be converted to a number, NaN is returned. | ||
* @example | ||
* var $parseInt = require('parse-int-x').parseInt2016; | ||
* | ||
* // The following examples all return 15 | ||
* $parseInt(' 0xF', 16); | ||
* $parseInt(' F', 16); | ||
* $parseInt('17', 8); | ||
* $parseInt(021, 8); | ||
* $parseInt('015', 10); // $parseInt(015, 10); will return 15 | ||
* $parseInt(15.99, 10); | ||
* $parseInt('15,123', 10); | ||
* $parseInt('FXX123', 16); | ||
* $parseInt('1111', 2); | ||
* $parseInt('15 * 3', 10); | ||
* $parseInt('15e2', 10); | ||
* $parseInt('15px', 10); | ||
* $parseInt('12', 13); | ||
* | ||
* //The following examples all return NaN: | ||
* $parseInt('Hello', 8); // Not a number at all | ||
* $parseInt('546', 2); // Digits are not valid for binary representations | ||
*/ | ||
parseInt2016: $parseInt2016, | ||
/** | ||
* This method parses a string argument and returns an integer of the specified | ||
* radix (the base in mathematical numeral systems). (ES2018) | ||
* | ||
* @param {string} string - The value to parse. If the string argument is not a | ||
* string, then it is converted to a string (using the ToString abstract | ||
* operation). Leading whitespace in the string argument is ignored. | ||
* @param {number} radix - An integer between 2 and 36 that represents the radix | ||
* (the base in mathematical numeral systems) of the above mentioned string. | ||
* Specify 10 for the decimal numeral system commonly used by humans. Always | ||
* specify this parameter to eliminate reader confusion and to guarantee | ||
* predictable behavior. Different implementations produce different results | ||
* when a radix is not specified, usually defaulting the value to 10. | ||
* @throws {TypeError} If target is a Symbol or is not coercible. | ||
* @returns {number} An integer number parsed from the given string. If the first | ||
* character cannot be converted to a number, NaN is returned. | ||
* @example | ||
* var $parseInt = require('parse-int-x').parseInt2018; | ||
* | ||
* // The following examples all return 15 | ||
* $parseInt(' 0xF', 16); | ||
* $parseInt(' F', 16); | ||
* $parseInt('17', 8); | ||
* $parseInt(021, 8); | ||
* $parseInt('015', 10); // $parseInt(015, 10); will return 15 | ||
* $parseInt(15.99, 10); | ||
* $parseInt('15,123', 10); | ||
* $parseInt('FXX123', 16); | ||
* $parseInt('1111', 2); | ||
* $parseInt('15 * 3', 10); | ||
* $parseInt('15e2', 10); | ||
* $parseInt('15px', 10); | ||
* $parseInt('12', 13); | ||
* | ||
* //The following examples all return NaN: | ||
* $parseInt('Hello', 8); // Not a number at all | ||
* $parseInt('546', 2); // Digits are not valid for binary representations | ||
*/ | ||
parseInt2018: $parseInt2018 | ||
}; | ||
},{"cached-constructors-x":3,"nan-x":18,"to-string-x":29,"trim-left-x":30}],21:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Replace the comments in a string. | ||
* @version 1.0.3 | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -538,4 +951,6 @@ * @copyright Xotic750 | ||
var isString = _dereq_('is-string'); | ||
var toStr = _dereq_('to-string-x'); | ||
var requireCoercibleToString = _dereq_('require-coercible-to-string-x'); | ||
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; | ||
var replace = ''.replace; | ||
@@ -547,2 +962,4 @@ /** | ||
* @param {string} [replacement] - The string to be used as a replacement. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @throws {TypeError} If replacement is not coercible. | ||
* @returns {string} The new string with the comments replaced. | ||
@@ -556,8 +973,42 @@ * @example | ||
module.exports = function replaceComments(string) { | ||
var replacement = arguments.length > 1 && isString(arguments[1]) ? arguments[1] : ''; | ||
return isString(string) ? string.replace(STRIP_COMMENTS, replacement) : ''; | ||
return replace.call(requireCoercibleToString(string), STRIP_COMMENTS, arguments.length > 1 ? toStr(arguments[1]) : ''); | ||
}; | ||
},{"is-string":10}],17:[function(_dereq_,module,exports){ | ||
},{"require-coercible-to-string-x":22,"to-string-x":29}],22:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Requires an argument is corecible then converts using ToString. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module require-coercible-to-string-x | ||
*/ | ||
'use strict'; | ||
var requireObjectCoercible = _dereq_('require-object-coercible-x'); | ||
var toStr = _dereq_('to-string-x'); | ||
/** | ||
* This method requires an argument is corecible then converts using ToString. | ||
* | ||
* @param {*} value - The value to converted to a string. | ||
* @throws {TypeError} If value is null or undefined. | ||
* @returns {string} The value as a string. | ||
* @example | ||
* var requireCoercibleToString = require('require-coercible-to-string-x'); | ||
* | ||
* requireCoercibleToString(); // TypeError | ||
* requireCoercibleToString(null); // TypeError | ||
* requireCoercibleToString(Symbol('')); // TypeError | ||
* requireCoercibleToString(Object.create(null)); // TypeError | ||
* requireCoercibleToString(1); // '1' | ||
* requireCoercibleToString(true); // 'true' | ||
*/ | ||
module.exports = function requireCoercibleToString(value) { | ||
return toStr(requireObjectCoercible(value)); | ||
}; | ||
},{"require-object-coercible-x":23,"to-string-x":29}],23:[function(_dereq_,module,exports){ | ||
/** | ||
* @file ES6-compliant shim for RequireObjectCoercible. | ||
@@ -600,7 +1051,36 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible|7.2.1 RequireObjectCoercible ( argument )} | ||
},{"is-nil-x":8}],18:[function(_dereq_,module,exports){ | ||
},{"is-nil-x":12}],24:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Converts argument to a value of type Boolean. | ||
* @version 1.0.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module to-boolean-x | ||
*/ | ||
'use strict'; | ||
/** | ||
* The abstract operation ToBoolean converts argument to a value of type Boolean. | ||
* | ||
* @param {*} value - The value to be converted. | ||
* @returns {boolean} 'true' if value is truthy; otherwise 'false'. | ||
* @example | ||
* var toBoolean = require('to-boolean-x'); | ||
* | ||
* toBoolean(null); // false | ||
* toBoolean(''); // false | ||
* toBoolean(1); // true | ||
* toBoolean('0'); // true | ||
*/ | ||
module.exports = function toBoolean(value) { | ||
return !!value; | ||
}; | ||
},{}],25:[function(_dereq_,module,exports){ | ||
/** | ||
* @file ToInteger converts 'argument' to an integral numeric value. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger|7.1.4 ToInteger ( argument )} | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -614,22 +1094,15 @@ * @copyright Xotic750 | ||
var toNumber = _dereq_('to-number-x'); | ||
var libToNumber = _dereq_('to-number-x'); | ||
var toNumber2016 = libToNumber.toNumber2016; | ||
var toNumber2018 = libToNumber.toNumber2018; | ||
var numberIsNaN = _dereq_('is-nan-x'); | ||
var numberIsFinite = _dereq_('is-finite-x'); | ||
var mathSign = _dereq_('math-sign-x'); | ||
var libMathSign = _dereq_('math-sign-x'); | ||
var mathSign2016 = libMathSign.sign2016; | ||
var mathSign2018 = libMathSign.sign2018; | ||
var mathFloor = Math.floor; | ||
var mathAbs = Math.abs; | ||
/** | ||
* Converts `value` to an integer. | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* | ||
* @example | ||
* var toInteger = require('to-integer-x'); | ||
* toInteger(3); // 3 | ||
* toInteger(Number.MIN_VALUE); // 0 | ||
* toInteger(Infinity); // 1.7976931348623157e+308 | ||
* toInteger('3'); // 3 | ||
*/ | ||
module.exports = function toInteger(value) { | ||
var number = toNumber(value); | ||
var $toInteger2016 = function toInteger2016(value) { | ||
var number = toNumber2016(value); | ||
if (numberIsNaN(number)) { | ||
@@ -643,9 +1116,59 @@ return 0; | ||
return mathSign(number) * Math.floor(Math.abs(number)); | ||
return mathSign2016(number) * mathFloor(mathAbs(number)); | ||
}; | ||
},{"is-finite-x":5,"is-nan-x":7,"math-sign-x":13,"to-number-x":19}],19:[function(_dereq_,module,exports){ | ||
var $toInteger2018 = function toInteger2018(value) { | ||
var number = toNumber2018(value); | ||
if (numberIsNaN(number)) { | ||
return 0; | ||
} | ||
if (number === 0 || numberIsFinite(number) === false) { | ||
return number; | ||
} | ||
return mathSign2018(number) * mathFloor(mathAbs(number)); | ||
}; | ||
module.exports = { | ||
/** | ||
* Reference to toInteger2018. | ||
*/ | ||
toInteger: $toInteger2018, | ||
/** | ||
* Converts `value` to an integer. (ES2016) | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* | ||
* @example | ||
* var toInteger = require('to-integer-x').toInteger2016; | ||
* toInteger(3); // 3 | ||
* toInteger(Number.MIN_VALUE); // 0 | ||
* toInteger(Infinity); // 1.7976931348623157e+308 | ||
* toInteger('3'); // 3 | ||
*/ | ||
toInteger2016: $toInteger2016, | ||
/** | ||
* Converts `value` to an integer. (ES2018) | ||
* | ||
* @param {*} value - The value to convert. | ||
* @returns {number} Returns the converted integer. | ||
* | ||
* @example | ||
* var toInteger = require('to-integer-x').toInteger2018; | ||
* toInteger(3); // 3 | ||
* toInteger(Number.MIN_VALUE); // 0 | ||
* toInteger(Infinity); // 1.7976931348623157e+308 | ||
* toInteger('3'); // 3 | ||
*/ | ||
toInteger2018: $toInteger2018 | ||
}; | ||
},{"is-finite-x":9,"is-nan-x":11,"math-sign-x":16,"to-number-x":26}],26:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Converts argument to a value of type Number. | ||
* @version 1.1.0 | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -659,8 +1182,18 @@ * @copyright Xotic750 | ||
var cachedCtrs = _dereq_('cached-constructors-x'); | ||
var castNumber = cachedCtrs.Number; | ||
var Rx = cachedCtrs.RegExp; | ||
var toPrimitive = _dereq_('to-primitive-x'); | ||
var trim = _dereq_('trim-x'); | ||
var pStrSlice = String.prototype.slice; | ||
var libTrim = _dereq_('trim-x'); | ||
var trim2016 = libTrim.trim2016; | ||
var trim2018 = libTrim.trim2018; | ||
var libParseInt = _dereq_('parse-int-x'); | ||
var $parseInt2016 = libParseInt.parseInt2016; | ||
var $parseInt2018 = libParseInt.parseInt2018; | ||
var pStrSlice = cachedCtrs.String.prototype.slice; | ||
var NAN = _dereq_('nan-x'); | ||
var binaryRegex = /^0b[01]+$/i; | ||
// Note that in IE 8, RegExp.prototype.test doesn't seem to exist: ie, "test" is an own property of regexes. wtf. | ||
// Note that in IE 8, RegExp.prototype.test doesn't seem to exist: ie, "test" is | ||
// an own property of regexes. wtf. | ||
var test = binaryRegex.test; | ||
@@ -676,11 +1209,10 @@ var isBinary = function _isBinary(value) { | ||
var nonWS = [ | ||
'\u0085', | ||
'\u200b', | ||
'\ufffe' | ||
].join(''); | ||
var nonWSregex2016 = new Rx('[\u0085\u200b\ufffe]', 'g'); | ||
var hasNonWS2016 = function _hasNonWS(value) { | ||
return test.call(nonWSregex2016, value); | ||
}; | ||
var nonWSregex = new RegExp('[' + nonWS + ']', 'g'); | ||
var hasNonWS = function _hasNonWS(value) { | ||
return test.call(nonWSregex, value); | ||
var nonWSregex2018 = new Rx('[\u0085\u180e\u200b\ufffe]', 'g'); | ||
var hasNonWS2018 = function _hasNonWS(value) { | ||
return test.call(nonWSregex2018, value); | ||
}; | ||
@@ -693,3 +1225,3 @@ | ||
var $toNumber = function toNumber(argument) { | ||
var $toNumber2016 = function toNumber2016(argument) { | ||
var value = toPrimitive(argument, Number); | ||
@@ -702,41 +1234,107 @@ if (typeof value === 'symbol') { | ||
if (isBinary(value)) { | ||
return $toNumber(parseInt(pStrSlice.call(value, 2), 2)); | ||
return toNumber2016($parseInt2016(pStrSlice.call(value, 2), 2)); | ||
} | ||
if (isOctal(value)) { | ||
return $toNumber(parseInt(pStrSlice.call(value, 2), 8)); | ||
return toNumber2016($parseInt2016(pStrSlice.call(value, 2), 8)); | ||
} | ||
if (hasNonWS(value) || isInvalidHexLiteral(value)) { | ||
return NaN; | ||
if (hasNonWS2016(value) || isInvalidHexLiteral(value)) { | ||
return NAN; | ||
} | ||
var trimmed = trim(value); | ||
var trimmed = trim2016(value); | ||
if (trimmed !== value) { | ||
return $toNumber(trimmed); | ||
return toNumber2016(trimmed); | ||
} | ||
} | ||
return Number(value); | ||
return castNumber(value); | ||
}; | ||
/** | ||
* This method converts argument to a value of type Number. | ||
var $toNumber2018 = function toNumber2018(argument) { | ||
var value = toPrimitive(argument, Number); | ||
if (typeof value === 'symbol') { | ||
throw new TypeError('Cannot convert a Symbol value to a number'); | ||
} | ||
* @param {*} argument The argument to convert to a number. | ||
* @throws {TypeError} If argument is a Symbol. | ||
* @return {*} The argument converted to a number. | ||
* @example | ||
* var toNumber = require('to-number-x'); | ||
* | ||
* toNumber('1'); // 1 | ||
* toNumber(null); // 0 | ||
* toNumber(true); // 1 | ||
*/ | ||
module.exports = $toNumber; | ||
if (typeof value === 'string') { | ||
if (isBinary(value)) { | ||
return toNumber2018($parseInt2018(pStrSlice.call(value, 2), 2)); | ||
} | ||
},{"to-primitive-x":20,"trim-x":25}],20:[function(_dereq_,module,exports){ | ||
if (isOctal(value)) { | ||
return toNumber2018($parseInt2018(pStrSlice.call(value, 2), 8)); | ||
} | ||
if (hasNonWS2018(value) || isInvalidHexLiteral(value)) { | ||
return NAN; | ||
} | ||
var trimmed = trim2018(value); | ||
if (trimmed !== value) { | ||
return toNumber2018(trimmed); | ||
} | ||
} | ||
return castNumber(value); | ||
}; | ||
module.exports = { | ||
/** | ||
* reference to toNumber2018. | ||
*/ | ||
toNumber: $toNumber2018, | ||
/** | ||
* This method converts argument to a value of type Number. (ES2016) | ||
* @param {*} argument - The argument to convert to a number. | ||
* @throws {TypeError} - If argument is a Symbol or not coercible. | ||
* @returns {*} The argument converted to a number. | ||
* @example | ||
* var toNumber = require('to-number-x').toNumber2016; | ||
* | ||
* toNumber('1'); // 1 | ||
* toNumber(null); // 0 | ||
* toNumber(true); // 1 | ||
* toNumber('0o10'); // 8 | ||
* toNumber('0b10'); // 2 | ||
* toNumber('0xF'); // 16 | ||
* | ||
* toNumber(' 1 '); // 1 | ||
* | ||
* toNumber(Symbol('')) // TypeError | ||
* toNumber(Object.create(null)) // TypeError | ||
*/ | ||
toNumber2016: $toNumber2016, | ||
/** | ||
* This method converts argument to a value of type Number. (ES2018) | ||
* @param {*} argument - The argument to convert to a number. | ||
* @throws {TypeError} - If argument is a Symbol or not coercible. | ||
* @returns {*} The argument converted to a number. | ||
* @example | ||
* var toNumber = require('to-number-x').toNumber2018; | ||
* | ||
* toNumber('1'); // 1 | ||
* toNumber(null); // 0 | ||
* toNumber(true); // 1 | ||
* toNumber('0o10'); // 8 | ||
* toNumber('0b10'); // 2 | ||
* toNumber('0xF'); // 16 | ||
* | ||
* toNumber(' 1 '); // 1 | ||
* | ||
* toNumber(Symbol('')) // TypeError | ||
* toNumber(Object.create(null)) // TypeError | ||
*/ | ||
toNumber2018: $toNumber2018 | ||
}; | ||
},{"cached-constructors-x":3,"nan-x":18,"parse-int-x":20,"to-primitive-x":27,"trim-x":32}],27:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Converts a JavaScript object to a primitive value. | ||
* @version 1.0.1 | ||
* @version 1.1.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -862,7 +1460,7 @@ * @copyright Xotic750 | ||
},{"has-symbol-support-x":2,"is-date-object":4,"is-function-x":6,"is-nil-x":8,"is-primitive":9,"is-symbol":11,"require-object-coercible-x":17,"validate.io-undefined":26}],21:[function(_dereq_,module,exports){ | ||
},{"has-symbol-support-x":4,"is-date-object":7,"is-function-x":10,"is-nil-x":12,"is-primitive":13,"is-symbol":14,"require-object-coercible-x":23,"validate.io-undefined":33}],28:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Get an object's ES6 @@toStringTag. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring|19.1.3.6 Object.prototype.toString ( )} | ||
* @version 1.4.1 | ||
* @version 1.4.2 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -878,3 +1476,3 @@ * @copyright Xotic750 | ||
var isUndefined = _dereq_('validate.io-undefined'); | ||
var toStr = Object.prototype.toString; | ||
var toStr = {}.toString; | ||
@@ -905,7 +1503,7 @@ /** | ||
},{"lodash.isnull":12,"validate.io-undefined":26}],22:[function(_dereq_,module,exports){ | ||
},{"lodash.isnull":15,"validate.io-undefined":33}],29:[function(_dereq_,module,exports){ | ||
/** | ||
* @file ES6-compliant shim for ToString. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tostring|7.1.12 ToString ( argument )} | ||
* @version 1.4.1 | ||
* @version 1.4.2 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -919,2 +1517,3 @@ * @copyright Xotic750 | ||
var castString = ''.constructor; | ||
var isSymbol = _dereq_('is-symbol'); | ||
@@ -938,2 +1537,3 @@ | ||
* $toString(Object(Symbol.iterator)); // TypeError | ||
* $toString(Object.create(null)); // TypeError | ||
*/ | ||
@@ -945,9 +1545,9 @@ module.exports = function ToString(value) { | ||
return String(value); | ||
return castString(value); | ||
}; | ||
},{"is-symbol":11}],23:[function(_dereq_,module,exports){ | ||
},{"is-symbol":14}],30:[function(_dereq_,module,exports){ | ||
/** | ||
* @file This method removes whitespace from the left end of a string. | ||
* @version 1.3.5 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -961,23 +1561,53 @@ * @copyright Xotic750 | ||
var $toString = _dereq_('to-string-x'); | ||
var reLeft = new RegExp('^[' + _dereq_('white-space-x').string + ']+'); | ||
var requireCoercibleToString = _dereq_('require-coercible-to-string-x'); | ||
var Rx = _dereq_('cached-constructors-x').RegExp; | ||
var reLeft2016 = new Rx('^[' + _dereq_('white-space-x').string2016 + ']+'); | ||
var reLeft2018 = new Rx('^[' + _dereq_('white-space-x').string2018 + ']+'); | ||
var replace = ''.replace; | ||
/** | ||
* This method removes whitespace from the left end of a string. | ||
* | ||
* @param {string} string - The string to trim the left end whitespace from. | ||
* @returns {undefined|string} The left trimmed string. | ||
* @example | ||
* var trimLeft = require('trim-left-x'); | ||
* | ||
* trimLeft(' \t\na \t\n') === 'a \t\n'; // true | ||
*/ | ||
module.exports = function trimLeft(string) { | ||
return $toString(string).replace(reLeft, ''); | ||
var $trimLeft2016 = function trimLeft2016(string) { | ||
return replace.call(requireCoercibleToString(string), reLeft2016, ''); | ||
}; | ||
},{"to-string-x":22,"white-space-x":27}],24:[function(_dereq_,module,exports){ | ||
var $trimLeft2018 = function trimLeft2018(string) { | ||
return replace.call(requireCoercibleToString(string), reLeft2018, ''); | ||
}; | ||
module.exports = { | ||
/** | ||
* A reference to leftTrim2018. | ||
*/ | ||
trimLeft: $trimLeft2018, | ||
/** | ||
* This method removes whitespace from the left end of a string. (ES2016) | ||
* | ||
* @param {string} string - The string to trim the left end whitespace from. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The left trimmed string. | ||
* @example | ||
* var trimLeft = require('trim-left-x').trimLeft2016; | ||
* | ||
* trimLeft(' \t\na \t\n') === 'a \t\n'; // true | ||
*/ | ||
trimLeft2016: $trimLeft2016, | ||
/** | ||
* This method removes whitespace from the left end of a string. (ES2018) | ||
* | ||
* @param {string} string - The string to trim the left end whitespace from. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The left trimmed string. | ||
* @example | ||
* var trimLeft = require('trim-left-x').trimLeft2018; | ||
* | ||
* trimLeft(' \t\na \t\n') === 'a \t\n'; // true | ||
*/ | ||
trimLeft2018: $trimLeft2018 | ||
}; | ||
},{"cached-constructors-x":3,"require-coercible-to-string-x":22,"white-space-x":34}],31:[function(_dereq_,module,exports){ | ||
/** | ||
* @file This method removes whitespace from the right end of a string. | ||
* @version 1.3.3 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -991,23 +1621,53 @@ * @copyright Xotic750 | ||
var $toString = _dereq_('to-string-x'); | ||
var reRight = new RegExp('[' + _dereq_('white-space-x').string + ']+$'); | ||
var requireCoercibleToString = _dereq_('require-coercible-to-string-x'); | ||
var Rx = _dereq_('cached-constructors-x').RegExp; | ||
var reRight2016 = new Rx('[' + _dereq_('white-space-x').string2016 + ']+$'); | ||
var reRight2018 = new Rx('[' + _dereq_('white-space-x').string2018 + ']+$'); | ||
var replace = ''.replace; | ||
/** | ||
* This method removes whitespace from the right end of a string. | ||
* | ||
* @param {string} string - The string to trim the right end whitespace from. | ||
* @returns {undefined|string} The right trimmed string. | ||
* @example | ||
* var trimRight = require('trim-right-x'); | ||
* | ||
* trimRight(' \t\na \t\n') === ' \t\na'; // true | ||
*/ | ||
module.exports = function trimRight(string) { | ||
return $toString(string).replace(reRight, ''); | ||
var $trimRight2016 = function trimRight2016(string) { | ||
return replace.call(requireCoercibleToString(string), reRight2016, ''); | ||
}; | ||
},{"to-string-x":22,"white-space-x":27}],25:[function(_dereq_,module,exports){ | ||
var $trimRight2018 = function trimRight2018(string) { | ||
return replace.call(requireCoercibleToString(string), reRight2018, ''); | ||
}; | ||
module.exports = { | ||
/** | ||
* A reference to trimRight2018. | ||
*/ | ||
trimRight: $trimRight2018, | ||
/** | ||
* This method removes whitespace from the right end of a string. (ES2016) | ||
* | ||
* @param {string} string - The string to trim the right end whitespace from. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The right trimmed string. | ||
* @example | ||
* var trimRight = require('trim-right-x'); | ||
* | ||
* trimRight(' \t\na \t\n') === ' \t\na'; // true | ||
*/ | ||
trimRight2016: $trimRight2016, | ||
/** | ||
* This method removes whitespace from the right end of a string. (ES2018) | ||
* | ||
* @param {string} string - The string to trim the right end whitespace from. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The right trimmed string. | ||
* @example | ||
* var trimRight = require('trim-right-x'); | ||
* | ||
* trimRight(' \t\na \t\n') === ' \t\na'; // true | ||
*/ | ||
trimRight2018: $trimRight2018 | ||
}; | ||
},{"cached-constructors-x":3,"require-coercible-to-string-x":22,"white-space-x":34}],32:[function(_dereq_,module,exports){ | ||
/** | ||
* @file This method removes whitespace from the left and right end of a string. | ||
* @version 1.0.3 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -1021,20 +1681,52 @@ * @copyright Xotic750 | ||
var trimLeft = _dereq_('trim-left-x'); | ||
var trimRight = _dereq_('trim-right-x'); | ||
var libTrimLeft = _dereq_('trim-left-x'); | ||
var trimLeft2016 = libTrimLeft.trimLeft2016; | ||
var trimLeft2018 = libTrimLeft.trimLeft2018; | ||
var libTrimRight = _dereq_('trim-right-x'); | ||
var trimRight2016 = libTrimRight.trimRight2016; | ||
var trimRight2018 = libTrimRight.trimRight2016; | ||
/** | ||
* This method removes whitespace from the left and right end of a string. | ||
* | ||
* @param {string} string - The string to trim the whitespace from. | ||
* @returns {undefined|string} The trimmed string. | ||
* @example | ||
* var trim = require('trim-x'); | ||
* | ||
* trim(' \t\na \t\n') === 'a'; // true | ||
*/ | ||
module.exports = function trim(string) { | ||
return trimLeft(trimRight(string)); | ||
var $trim2016 = function trim2016(string) { | ||
return trimLeft2016(trimRight2016(string)); | ||
}; | ||
},{"trim-left-x":23,"trim-right-x":24}],26:[function(_dereq_,module,exports){ | ||
var $trim2018 = function trim2018(string) { | ||
return trimLeft2018(trimRight2018(string)); | ||
}; | ||
module.exports = { | ||
/** | ||
* A reference to trim2018. | ||
*/ | ||
trim: $trim2018, | ||
/** | ||
* This method removes whitespace from the left and right end of a string. | ||
* (ES2016) | ||
* @param {string} string - The string to trim the whitespace from. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The trimmed string. | ||
* @example | ||
* var trim = require('trim-x'); | ||
* | ||
* trim(' \t\na \t\n') === 'a'; // true | ||
*/ | ||
trim2016: $trim2016, | ||
/** | ||
* This method removes whitespace from the left and right end of a string. | ||
* (ES2018) | ||
* | ||
* @param {string} string - The string to trim the whitespace from. | ||
* @throws {TypeError} If string is null or undefined or not coercible. | ||
* @returns {string} The trimmed string. | ||
* @example | ||
* var trim = require('trim-x'); | ||
* | ||
* trim(' \t\na \t\n') === 'a'; // true | ||
*/ | ||
trim2018: $trim2018 | ||
}; | ||
},{"trim-left-x":30,"trim-right-x":31}],33:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -1086,6 +1778,6 @@ * | ||
},{}],27:[function(_dereq_,module,exports){ | ||
},{}],34:[function(_dereq_,module,exports){ | ||
/** | ||
* @file List of ECMAScript5 white space characters. | ||
* @version 2.0.3 | ||
* @file List of ECMAScript white space characters. | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -1100,12 +1792,22 @@ * @copyright Xotic750 | ||
/** | ||
* An array of the ES5 whitespace char codes, string, and their descriptions. | ||
* A record of a white space character. | ||
* | ||
* @name list | ||
* @type Array.<Object> | ||
* @example | ||
* var whiteSpace = require('white-space-x'); | ||
* whiteSpaces.list.foreach(function (item) { | ||
* console.log(lib.description, item.code, item.string); | ||
* }); | ||
* @typedef {Object} CharRecord | ||
* @property {number} code - The character code. | ||
* @property {string} description - A description of the character. | ||
* @property {boolean} es5 - Whether the spec lists this as a white space. | ||
* @property {boolean} es2015 - Whether the spec lists this as a white space. | ||
* @property {boolean} es2016 - Whether the spec lists this as a white space. | ||
* @property {boolean} es2017 - Whether the spec lists this as a white space. | ||
* @property {boolean} es2018 - Whether the spec lists this as a white space. | ||
* @property {string} string - The character string. | ||
*/ | ||
/** | ||
* An array of the whitespace char codes, string, descriptions and language | ||
* presence in the specifications. | ||
* | ||
* @private | ||
* @type Array.<CharRecord> | ||
*/ | ||
var list = [ | ||
@@ -1115,2 +1817,7 @@ { | ||
description: 'Tab', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u0009' | ||
@@ -1121,2 +1828,7 @@ }, | ||
description: 'Line Feed', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u000a' | ||
@@ -1127,2 +1839,7 @@ }, | ||
description: 'Vertical Tab', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u000b' | ||
@@ -1133,2 +1850,7 @@ }, | ||
description: 'Form Feed', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u000c' | ||
@@ -1139,2 +1861,7 @@ }, | ||
description: 'Carriage Return', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u000d' | ||
@@ -1145,2 +1872,7 @@ }, | ||
description: 'Space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u0020' | ||
@@ -1151,3 +1883,8 @@ }, | ||
code: 0x0085, | ||
description: 'Next line - Not ES5 whitespace', | ||
description: 'Next line', | ||
es5: false, | ||
es2015: false, | ||
es2016: false, | ||
es2017: false, | ||
es2018: false, | ||
string: '\u0085' | ||
@@ -1159,2 +1896,7 @@ } | ||
description: 'No-break space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u00a0' | ||
@@ -1165,2 +1907,7 @@ }, | ||
description: 'Ogham space mark', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u1680' | ||
@@ -1171,2 +1918,7 @@ }, | ||
description: 'Mongolian vowel separator', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: false, | ||
es2018: false, | ||
string: '\u180e' | ||
@@ -1177,2 +1929,7 @@ }, | ||
description: 'En quad', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2000' | ||
@@ -1183,2 +1940,7 @@ }, | ||
description: 'Em quad', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2001' | ||
@@ -1189,2 +1951,7 @@ }, | ||
description: 'En space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2002' | ||
@@ -1195,2 +1962,7 @@ }, | ||
description: 'Em space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2003' | ||
@@ -1201,2 +1973,7 @@ }, | ||
description: 'Three-per-em space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2004' | ||
@@ -1207,2 +1984,7 @@ }, | ||
description: 'Four-per-em space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2005' | ||
@@ -1213,2 +1995,7 @@ }, | ||
description: 'Six-per-em space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2006' | ||
@@ -1219,2 +2006,7 @@ }, | ||
description: 'Figure space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2007' | ||
@@ -1225,2 +2017,7 @@ }, | ||
description: 'Punctuation space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2008' | ||
@@ -1231,2 +2028,7 @@ }, | ||
description: 'Thin space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2009' | ||
@@ -1237,2 +2039,7 @@ }, | ||
description: 'Hair space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u200a' | ||
@@ -1243,3 +2050,8 @@ }, | ||
code: 0x200b, | ||
description: 'Zero width space - Not ES5 whitespace', | ||
description: 'Zero width space', | ||
es5: false, | ||
es2015: false, | ||
es2016: false, | ||
es2017: false, | ||
es2018: false, | ||
string: '\u200b' | ||
@@ -1251,2 +2063,7 @@ }, | ||
description: 'Line separator', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2028' | ||
@@ -1257,2 +2074,7 @@ }, | ||
description: 'Paragraph separator', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u2029' | ||
@@ -1263,2 +2085,7 @@ }, | ||
description: 'Narrow no-break space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u202f' | ||
@@ -1269,2 +2096,7 @@ }, | ||
description: 'Medium mathematical space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u205f' | ||
@@ -1275,2 +2107,7 @@ }, | ||
description: 'Ideographic space', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\u3000' | ||
@@ -1281,2 +2118,7 @@ }, | ||
description: 'Byte Order Mark', | ||
es5: true, | ||
es2015: true, | ||
es2016: true, | ||
es2017: true, | ||
es2018: true, | ||
string: '\ufeff' | ||
@@ -1286,50 +2128,134 @@ } | ||
var string = ''; | ||
var stringES2016 = ''; | ||
var stringES2018 = ''; | ||
var length = list.length; | ||
for (var i = 0; i < length; i += 1) { | ||
string += list[i].string; | ||
if (list[i].es2016) { | ||
stringES2016 += list[i].string; | ||
} | ||
if (list[i].es2018) { | ||
stringES2018 += list[i].string; | ||
} | ||
} | ||
/** | ||
* A string of the ES5 whitespace characters. | ||
* | ||
* @name string | ||
* @type string | ||
* @example | ||
* var whiteSpace = require('white-space-x'); | ||
* var characters = [ | ||
* '\u0009', | ||
* '\u000a', | ||
* '\u000b', | ||
* '\u000c', | ||
* '\u000d', | ||
* '\u0020', | ||
* '\u00a0', | ||
* '\u1680', | ||
* '\u180e', | ||
* '\u2000', | ||
* '\u2001', | ||
* '\u2002', | ||
* '\u2003', | ||
* '\u2004', | ||
* '\u2005', | ||
* '\u2006', | ||
* '\u2007', | ||
* '\u2008', | ||
* '\u2009', | ||
* '\u200a', | ||
* '\u2028', | ||
* '\u2029', | ||
* '\u202f', | ||
* '\u205f', | ||
* '\u3000', | ||
* '\ufeff' | ||
* ]; | ||
* var ws = characters.join(''); | ||
* var re1 = new RegExp('^[' + whiteSpace.string + ']+$)'); | ||
* re1.test(ws); // true | ||
*/ | ||
module.exports = { | ||
/** | ||
* An array of the whitespace char codes, string, descriptions and language | ||
* presence in the specifications. | ||
* | ||
* @type Array.<CharRecord> | ||
* @example | ||
* var whiteSpace = require('white-space-x'); | ||
* whiteSpaces.list.foreach(function (item) { | ||
* console.log(lib.description, item.code, item.string); | ||
* }); | ||
*/ | ||
list: list, | ||
string: string | ||
/** | ||
* A string of the ES2017 to ES2018 whitespace characters. | ||
* | ||
* @type string | ||
*/ | ||
string: stringES2018, | ||
/** | ||
* A string of the ES5 to ES2016 whitespace characters. | ||
* | ||
* @type string | ||
*/ | ||
string5: stringES2016, | ||
/** | ||
* A string of the ES5 to ES2016 whitespace characters. | ||
* | ||
* @type string | ||
*/ | ||
string2015: stringES2016, | ||
/** | ||
* A string of the ES5 to ES2016 whitespace characters. | ||
* | ||
* @type string | ||
* @example | ||
* var whiteSpace = require('white-space-x'); | ||
* var characters = [ | ||
* '\u0009', | ||
* '\u000a', | ||
* '\u000b', | ||
* '\u000c', | ||
* '\u000d', | ||
* '\u0020', | ||
* '\u00a0', | ||
* '\u1680', | ||
* '\u180e', | ||
* '\u2000', | ||
* '\u2001', | ||
* '\u2002', | ||
* '\u2003', | ||
* '\u2004', | ||
* '\u2005', | ||
* '\u2006', | ||
* '\u2007', | ||
* '\u2008', | ||
* '\u2009', | ||
* '\u200a', | ||
* '\u2028', | ||
* '\u2029', | ||
* '\u202f', | ||
* '\u205f', | ||
* '\u3000', | ||
* '\ufeff' | ||
* ]; | ||
* var ws = characters.join(''); | ||
* var re1 = new RegExp('^[' + whiteSpace.string2016 + ']+$)'); | ||
* re1.test(ws); // true | ||
*/ | ||
string2016: stringES2016, | ||
/** | ||
* A string of the ES2017 to ES2018 whitespace characters. | ||
* | ||
* @type string | ||
*/ | ||
string2017: stringES2018, | ||
/** | ||
* A string of the ES2017 to ES2018 whitespace characters. | ||
* | ||
* @type string | ||
* @example | ||
* var whiteSpace = require('white-space-x'); | ||
* var characters = [ | ||
* '\u0009', | ||
* '\u000a', | ||
* '\u000b', | ||
* '\u000c', | ||
* '\u000d', | ||
* '\u0020', | ||
* '\u00a0', | ||
* '\u1680', | ||
* '\u2000', | ||
* '\u2001', | ||
* '\u2002', | ||
* '\u2003', | ||
* '\u2004', | ||
* '\u2005', | ||
* '\u2006', | ||
* '\u2007', | ||
* '\u2008', | ||
* '\u2009', | ||
* '\u200a', | ||
* '\u2028', | ||
* '\u2029', | ||
* '\u202f', | ||
* '\u205f', | ||
* '\u3000', | ||
* '\ufeff' | ||
* ]; | ||
* var ws = characters.join(''); | ||
* var re1 = new RegExp('^[' + whiteSpace.string2018 + ']+$)'); | ||
* re1.test(ws); // true | ||
*/ | ||
string2018: stringES2018 | ||
}; | ||
@@ -1336,0 +2262,0 @@ |
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).returnExports=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for ToLength. | ||
* @file Shim for ToLength. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tolength|7.1.15 ToLength ( argument )} | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -10,3 +10,19 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var toInteger=_dereq_("to-integer-x"),MAX_SAFE_INTEGER=_dereq_("max-safe-integer");module.exports=function toLength(value){var len=toInteger(value);return len<=0?0:len>MAX_SAFE_INTEGER?MAX_SAFE_INTEGER:len}},{"max-safe-integer":14,"to-integer-x":18}],2:[function(_dereq_,module,exports){/** | ||
"use strict";var libToInteger=_dereq_("to-integer-x"),toInteger2016=libToInteger.toInteger2016,toInteger2018=libToInteger.toInteger2018,MAX_SAFE_INTEGER=_dereq_("max-safe-integer"),$toLength2018=function toLength2018(value){var len=toInteger2018(value);return len<=0?0:len>MAX_SAFE_INTEGER?MAX_SAFE_INTEGER:len};module.exports={toLength:$toLength2018,toLength2016:function toLength2016(value){var len=toInteger2016(value);return len<=0?0:len>MAX_SAFE_INTEGER?MAX_SAFE_INTEGER:len},toLength2018:$toLength2018}},{"max-safe-integer":17,"to-integer-x":25}],2:[function(_dereq_,module,exports){/** | ||
* @file Invokes function, returning an object of the results. | ||
* @version 1.1.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module attempt-x | ||
*/ | ||
"use strict";var getArgs=function _getArgs(args){var length=args.length>>>0,array=[],argLength=length-1;if(argLength<1)return array;array.length=argLength;for(var index=1;index<length;index+=1)array[index-1]=args[index];return array};module.exports=function attempt(fn){try{return{threw:!1,value:fn.apply(this,getArgs(arguments))}}catch(e){return{threw:!0,value:e}}}},{}],3:[function(_dereq_,module,exports){/** | ||
* @file Constructors cached from literals. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module cached-constructors-x | ||
*/ | ||
"use strict";module.exports={Array:[].constructor,Boolean:(!0).constructor,Number:(0).constructor,Object:{}.constructor,RegExp:/(?:)/.constructor,String:"".constructor}},{}],4:[function(_dereq_,module,exports){/** | ||
* @file Tests if ES6 Symbol is supported. | ||
@@ -19,3 +35,3 @@ * @version 1.4.1 | ||
*/ | ||
"use strict";module.exports="function"==typeof Symbol&&"symbol"==typeof Symbol("")},{}],3:[function(_dereq_,module,exports){/** | ||
"use strict";module.exports="function"==typeof Symbol&&"symbol"==typeof Symbol("")},{}],5:[function(_dereq_,module,exports){/** | ||
* @file Tests if ES6 @@toStringTag is supported. | ||
@@ -29,6 +45,22 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-@@tostringtag|26.3.1 @@toStringTag} | ||
*/ | ||
"use strict";module.exports=_dereq_("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag},{"has-symbol-support-x":2}],4:[function(_dereq_,module,exports){"use strict";var getDay=Date.prototype.getDay,tryDateObject=function tryDateObject(value){try{return getDay.call(value),!0}catch(e){return!1}},toStr=Object.prototype.toString,hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;module.exports=function isDateObject(value){return"object"==typeof value&&null!==value&&(hasToStringTag?tryDateObject(value):"[object Date]"===toStr.call(value))}},{}],5:[function(_dereq_,module,exports){/** | ||
"use strict";module.exports=_dereq_("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag},{"has-symbol-support-x":4}],6:[function(_dereq_,module,exports){/** | ||
* @file The constant value Infinity. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module infinity-x | ||
*/ | ||
"use strict";module.exports=1/0},{}],7:[function(_dereq_,module,exports){"use strict";var getDay=Date.prototype.getDay,tryDateObject=function tryDateObject(value){try{return getDay.call(value),!0}catch(e){return!1}},toStr=Object.prototype.toString,hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;module.exports=function isDateObject(value){return"object"==typeof value&&null!==value&&(hasToStringTag?tryDateObject(value):"[object Date]"===toStr.call(value))}},{}],8:[function(_dereq_,module,exports){/** | ||
* @file Test if a given value is falsey. | ||
* @version 1.0.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module is-falsey-x | ||
*/ | ||
"use strict";var toBoolean=_dereq_("to-boolean-x");module.exports=function isFalsey(value){return!1===toBoolean(value)}},{"to-boolean-x":24}],9:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for Number.isFinite. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-number.isfinite|20.1.2.2 Number.isFinite ( number )} | ||
* @version 3.0.1 | ||
* @version 3.0.2 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -39,5 +71,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var numberIsNaN=_dereq_("is-nan-x");module.exports=function isFinite(number){return"number"==typeof number&&!1===numberIsNaN(number)&&number!==1/0&&number!==-1/0}},{"is-nan-x":7}],6:[function(_dereq_,module,exports){/** | ||
"use strict";var numberIsNaN=_dereq_("is-nan-x"),INFINITY=_dereq_("infinity-x");module.exports=function isFinite(number){return"number"==typeof number&&!1===numberIsNaN(number)&&number!==INFINITY&&number!==-INFINITY}},{"infinity-x":6,"is-nan-x":11}],10:[function(_dereq_,module,exports){/** | ||
* @file Determine whether a given value is a function object. | ||
* @version 3.1.1 | ||
* @version 3.3.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -48,3 +80,3 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var fToString=Function.prototype.toString,toStringTag=_dereq_("to-string-tag-x"),hasToStringTag=_dereq_("has-to-string-tag-x"),isPrimitive=_dereq_("is-primitive"),normalise=_dereq_("normalize-space-x"),deComment=_dereq_("replace-comments-x"),hasNativeClass=!0;try{Function('"use strict"; return class My {};')()}catch(ignore){hasNativeClass=!1}var ctrRx=/^class /,isES6ClassFn=function isES6ClassFunc(value){try{return ctrRx.test(normalise(deComment(fToString.call(value)," ")))}catch(ignore){}return!1},tryFuncToString=function funcToString(value,allowClass){try{return(!hasNativeClass||!1!==allowClass||!isES6ClassFn(value))&&(fToString.call(value),!0)}catch(ignore){}return!1};module.exports=function isFunction(value){if(isPrimitive(value))return!1;var allowClass=arguments.length>0&&Boolean(arguments[1]);if(hasToStringTag)return tryFuncToString(value,allowClass);if(hasNativeClass&&!1===allowClass&&isES6ClassFn(value))return!1;var strTag=toStringTag(value);return"[object Function]"===strTag||"[object GeneratorFunction]"===strTag||"[object AsyncFunction]"===strTag}},{"has-to-string-tag-x":3,"is-primitive":9,"normalize-space-x":15,"replace-comments-x":16,"to-string-tag-x":21}],7:[function(_dereq_,module,exports){/** | ||
"use strict";var attempt=_dereq_("attempt-x"),fToString=Function.prototype.toString,toBoolean=_dereq_("to-boolean-x"),isFalsey=_dereq_("is-falsey-x"),toStringTag=_dereq_("to-string-tag-x"),hasToStringTag=_dereq_("has-to-string-tag-x"),isPrimitive=_dereq_("is-primitive"),normalise=_dereq_("normalize-space-x").normalizeSpace,deComment=_dereq_("replace-comments-x"),ctrRx=/^class /,test=ctrRx.test,hasNativeClass=!1===attempt(function(){return Function('"use strict"; return class My {};')()}).threw,testClassstring=function _testClassstring(value){return test.call(ctrRx,normalise(deComment(fToString.call(value)," ")))},isES6ClassFn=function isES6ClassFunc(value){var result=attempt(testClassstring,value);return!1===result.threw&&result.value},tryFuncToString=function funcToString(value,allowClass){return(!hasNativeClass||!1!==allowClass||!isES6ClassFn(value))&&!1===attempt.call(value,fToString).threw};module.exports=function isFunction(value){if(isPrimitive(value))return!1;if(hasToStringTag)return tryFuncToString(value,toBoolean(arguments[1]));if(hasNativeClass&&isFalsey(arguments[1])&&isES6ClassFn(value))return!1;var strTag=toStringTag(value);return"[object Function]"===strTag||"[object GeneratorFunction]"===strTag||"[object AsyncFunction]"===strTag}},{"attempt-x":2,"has-to-string-tag-x":5,"is-falsey-x":8,"is-primitive":13,"normalize-space-x":19,"replace-comments-x":21,"to-boolean-x":24,"to-string-tag-x":28}],11:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for Number.isNaN - the global isNaN returns false positives. | ||
@@ -57,3 +89,3 @@ * @version 1.0.1 | ||
*/ | ||
"use strict";module.exports=function isNaN(value){return value!==value}},{}],8:[function(_dereq_,module,exports){/** | ||
"use strict";module.exports=function isNaN(value){return value!==value}},{}],12:[function(_dereq_,module,exports){/** | ||
* @file Checks if `value` is `null` or `undefined`. | ||
@@ -66,6 +98,6 @@ * @version 1.4.1 | ||
*/ | ||
"use strict";var isUndefined=_dereq_("validate.io-undefined"),isNull=_dereq_("lodash.isnull");module.exports=function isNil(value){return isNull(value)||isUndefined(value)}},{"lodash.isnull":12,"validate.io-undefined":26}],9:[function(_dereq_,module,exports){"use strict";module.exports=function isPrimitive(value){return null==value||"function"!=typeof value&&"object"!=typeof value}},{}],10:[function(_dereq_,module,exports){"use strict";var strValue=String.prototype.valueOf,tryStringObject=function tryStringObject(value){try{return strValue.call(value),!0}catch(e){return!1}},toStr=Object.prototype.toString,hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;module.exports=function isString(value){return"string"==typeof value||"object"==typeof value&&(hasToStringTag?tryStringObject(value):"[object String]"===toStr.call(value))}},{}],11:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;if("function"==typeof Symbol&&"symbol"==typeof Symbol()){var symToStr=Symbol.prototype.toString,symStringRegex=/^Symbol\(.*\)$/,isSymbolObject=function isSymbolObject(value){return"symbol"==typeof value.valueOf()&&symStringRegex.test(symToStr.call(value))};module.exports=function isSymbol(value){if("symbol"==typeof value)return!0;if("[object Symbol]"!==toStr.call(value))return!1;try{return isSymbolObject(value)}catch(e){return!1}}}else module.exports=function isSymbol(value){return!1}},{}],12:[function(_dereq_,module,exports){module.exports=function isNull(value){return null===value}},{}],13:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for Math.sign. | ||
"use strict";var isUndefined=_dereq_("validate.io-undefined"),isNull=_dereq_("lodash.isnull");module.exports=function isNil(value){return isNull(value)||isUndefined(value)}},{"lodash.isnull":15,"validate.io-undefined":33}],13:[function(_dereq_,module,exports){"use strict";module.exports=function isPrimitive(value){return null==value||"function"!=typeof value&&"object"!=typeof value}},{}],14:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;if("function"==typeof Symbol&&"symbol"==typeof Symbol()){var symToStr=Symbol.prototype.toString,symStringRegex=/^Symbol\(.*\)$/,isSymbolObject=function isSymbolObject(value){return"symbol"==typeof value.valueOf()&&symStringRegex.test(symToStr.call(value))};module.exports=function isSymbol(value){if("symbol"==typeof value)return!0;if("[object Symbol]"!==toStr.call(value))return!1;try{return isSymbolObject(value)}catch(e){return!1}}}else module.exports=function isSymbol(value){return!1}},{}],15:[function(_dereq_,module,exports){module.exports=function isNull(value){return null===value}},{}],16:[function(_dereq_,module,exports){/** | ||
* @file Shim for Math.sign. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-math.sign|20.2.2.29 Math.sign(x)} | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -76,5 +108,13 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var toNumber=_dereq_("to-number-x"),numberIsNaN=_dereq_("is-nan-x");module.exports=function sign(x){var n=toNumber(x);return 0===n||numberIsNaN(n)?n:n>0?1:-1}},{"is-nan-x":7,"to-number-x":19}],14:[function(_dereq_,module,exports){"use strict";module.exports=9007199254740991},{}],15:[function(_dereq_,module,exports){/** | ||
"use strict";var libToNumber=_dereq_("to-number-x"),toNumber2016=libToNumber.toNumber2016,toNumber2018=libToNumber.toNumber2018,numberIsNaN=_dereq_("is-nan-x"),$sign2018=function sign2018(x){var n=toNumber2018(x);return 0===n||numberIsNaN(n)?n:n>0?1:-1};module.exports={sign:$sign2018,sign2016:function sign2016(x){var n=toNumber2016(x);return 0===n||numberIsNaN(n)?n:n>0?1:-1},sign2018:$sign2018}},{"is-nan-x":11,"to-number-x":26}],17:[function(_dereq_,module,exports){"use strict";module.exports=9007199254740991},{}],18:[function(_dereq_,module,exports){/** | ||
* @file The constant NaN derived mathematically by 0 / 0. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module nan-x | ||
*/ | ||
"use strict";module.exports=NaN},{}],19:[function(_dereq_,module,exports){/** | ||
* @file Trims and replaces sequences of whitespace characters by a single space. | ||
* @version 1.3.3 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -85,5 +125,13 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var trim=_dereq_("trim-x"),reNormalize=new RegExp("["+_dereq_("white-space-x").string+"]+","g");module.exports=function normalizeSpace(string){return trim(string).replace(reNormalize," ")}},{"trim-x":25,"white-space-x":27}],16:[function(_dereq_,module,exports){/** | ||
"use strict";var libTrim=_dereq_("trim-x"),trim2016=libTrim.trim2016,trim2018=libTrim.trim2018,Rx=_dereq_("cached-constructors-x").RegExp,libWhiteSpace=_dereq_("white-space-x"),reNormalize2016=new Rx("["+libWhiteSpace.string2016+"]+","g"),reNormalize2018=new Rx("["+libWhiteSpace.string2018+"]+","g"),replace="".replace,$normalizeSpace2018=function normalizeSpace2018(string){return replace.call(trim2018(string),reNormalize2018," ")};module.exports={normalizeSpace:$normalizeSpace2018,normalizeSpace2016:function normalizeSpace2016(string){return replace.call(trim2016(string),reNormalize2016," ")},normalizeSpace2018:$normalizeSpace2018}},{"cached-constructors-x":3,"trim-x":32,"white-space-x":34}],20:[function(_dereq_,module,exports){/** | ||
* @file Parses a string argument and returns an integer of the specified radix. | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module parse-int-x | ||
*/ | ||
"use strict";var nativeParseInt=parseInt,NAN=_dereq_("nan-x"),toStr=_dereq_("to-string-x"),trimLeft2016=_dereq_("trim-left-x").trimLeft2016,trimLeft2018=_dereq_("trim-left-x").trimLeft2018,chachedCtrs=_dereq_("cached-constructors-x"),castNumber=chachedCtrs.Number,charAt=chachedCtrs.String.prototype.charAt,hexRegex=/^[-+]?0[xX]/,test=hexRegex.test,$parseInt2018=function parseInt2018(string,radix){var str=trimLeft2018(toStr(string));return"\u180e"===charAt.call(str,0)?NAN:nativeParseInt(str,castNumber(radix)||(test.call(hexRegex,str)?16:10))};module.exports={parseInt:$parseInt2018,parseInt2016:function parseInt2016(string,radix){var str=trimLeft2016(toStr(string));return nativeParseInt(str,castNumber(radix)||(test.call(hexRegex,str)?16:10))},parseInt2018:$parseInt2018}},{"cached-constructors-x":3,"nan-x":18,"to-string-x":29,"trim-left-x":30}],21:[function(_dereq_,module,exports){/** | ||
* @file Replace the comments in a string. | ||
* @version 1.0.3 | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -94,3 +142,11 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var isString=_dereq_("is-string"),STRIP_COMMENTS=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;module.exports=function replaceComments(string){var replacement=arguments.length>1&&isString(arguments[1])?arguments[1]:"";return isString(string)?string.replace(STRIP_COMMENTS,replacement):""}},{"is-string":10}],17:[function(_dereq_,module,exports){/** | ||
"use strict";var toStr=_dereq_("to-string-x"),requireCoercibleToString=_dereq_("require-coercible-to-string-x"),STRIP_COMMENTS=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,replace="".replace;module.exports=function replaceComments(string){return replace.call(requireCoercibleToString(string),STRIP_COMMENTS,arguments.length>1?toStr(arguments[1]):"")}},{"require-coercible-to-string-x":22,"to-string-x":29}],22:[function(_dereq_,module,exports){/** | ||
* @file Requires an argument is corecible then converts using ToString. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module require-coercible-to-string-x | ||
*/ | ||
"use strict";var requireObjectCoercible=_dereq_("require-object-coercible-x"),toStr=_dereq_("to-string-x");module.exports=function requireCoercibleToString(value){return toStr(requireObjectCoercible(value))}},{"require-object-coercible-x":23,"to-string-x":29}],23:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for RequireObjectCoercible. | ||
@@ -104,6 +160,14 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible|7.2.1 RequireObjectCoercible ( argument )} | ||
*/ | ||
"use strict";var isNil=_dereq_("is-nil-x");module.exports=function RequireObjectCoercible(value){if(isNil(value))throw new TypeError("Cannot call method on "+value);return value}},{"is-nil-x":8}],18:[function(_dereq_,module,exports){/** | ||
"use strict";var isNil=_dereq_("is-nil-x");module.exports=function RequireObjectCoercible(value){if(isNil(value))throw new TypeError("Cannot call method on "+value);return value}},{"is-nil-x":12}],24:[function(_dereq_,module,exports){/** | ||
* @file Converts argument to a value of type Boolean. | ||
* @version 1.0.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module to-boolean-x | ||
*/ | ||
"use strict";module.exports=function toBoolean(value){return!!value}},{}],25:[function(_dereq_,module,exports){/** | ||
* @file ToInteger converts 'argument' to an integral numeric value. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger|7.1.4 ToInteger ( argument )} | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -114,5 +178,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var toNumber=_dereq_("to-number-x"),numberIsNaN=_dereq_("is-nan-x"),numberIsFinite=_dereq_("is-finite-x"),mathSign=_dereq_("math-sign-x");module.exports=function toInteger(value){var number=toNumber(value);return numberIsNaN(number)?0:0===number||!1===numberIsFinite(number)?number:mathSign(number)*Math.floor(Math.abs(number))}},{"is-finite-x":5,"is-nan-x":7,"math-sign-x":13,"to-number-x":19}],19:[function(_dereq_,module,exports){/** | ||
"use strict";var libToNumber=_dereq_("to-number-x"),toNumber2016=libToNumber.toNumber2016,toNumber2018=libToNumber.toNumber2018,numberIsNaN=_dereq_("is-nan-x"),numberIsFinite=_dereq_("is-finite-x"),libMathSign=_dereq_("math-sign-x"),mathSign2016=libMathSign.sign2016,mathSign2018=libMathSign.sign2018,mathFloor=Math.floor,mathAbs=Math.abs,$toInteger2018=function toInteger2018(value){var number=toNumber2018(value);return numberIsNaN(number)?0:0===number||!1===numberIsFinite(number)?number:mathSign2018(number)*mathFloor(mathAbs(number))};module.exports={toInteger:$toInteger2018,toInteger2016:function toInteger2016(value){var number=toNumber2016(value);return numberIsNaN(number)?0:0===number||!1===numberIsFinite(number)?number:mathSign2016(number)*mathFloor(mathAbs(number))},toInteger2018:$toInteger2018}},{"is-finite-x":9,"is-nan-x":11,"math-sign-x":16,"to-number-x":26}],26:[function(_dereq_,module,exports){/** | ||
* @file Converts argument to a value of type Number. | ||
* @version 1.1.0 | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -123,5 +187,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var toPrimitive=_dereq_("to-primitive-x"),trim=_dereq_("trim-x"),pStrSlice=String.prototype.slice,binaryRegex=/^0b[01]+$/i,test=binaryRegex.test,isBinary=function _isBinary(value){return test.call(binaryRegex,value)},octalRegex=/^0o[0-7]+$/i,isOctal=function _isOctal(value){return test.call(octalRegex,value)},nonWS=["\x85","\u200b","\ufffe"].join(""),nonWSregex=new RegExp("["+nonWS+"]","g"),hasNonWS=function _hasNonWS(value){return test.call(nonWSregex,value)},invalidHexLiteral=/^[-+]0x[0-9a-f]+$/i,isInvalidHexLiteral=function _isInvalidHexLiteral(value){return test.call(invalidHexLiteral,value)},$toNumber=function toNumber(argument){var value=toPrimitive(argument,Number);if("symbol"==typeof value)throw new TypeError("Cannot convert a Symbol value to a number");if("string"==typeof value){if(isBinary(value))return $toNumber(parseInt(pStrSlice.call(value,2),2));if(isOctal(value))return $toNumber(parseInt(pStrSlice.call(value,2),8));if(hasNonWS(value)||isInvalidHexLiteral(value))return NaN;var trimmed=trim(value);if(trimmed!==value)return $toNumber(trimmed)}return Number(value)};module.exports=$toNumber},{"to-primitive-x":20,"trim-x":25}],20:[function(_dereq_,module,exports){/** | ||
"use strict";var cachedCtrs=_dereq_("cached-constructors-x"),castNumber=cachedCtrs.Number,Rx=cachedCtrs.RegExp,toPrimitive=_dereq_("to-primitive-x"),libTrim=_dereq_("trim-x"),trim2016=libTrim.trim2016,trim2018=libTrim.trim2018,libParseInt=_dereq_("parse-int-x"),$parseInt2016=libParseInt.parseInt2016,$parseInt2018=libParseInt.parseInt2018,pStrSlice=cachedCtrs.String.prototype.slice,NAN=_dereq_("nan-x"),binaryRegex=/^0b[01]+$/i,test=binaryRegex.test,isBinary=function _isBinary(value){return test.call(binaryRegex,value)},octalRegex=/^0o[0-7]+$/i,isOctal=function _isOctal(value){return test.call(octalRegex,value)},nonWSregex2016=new Rx("[\x85\u200b\ufffe]","g"),hasNonWS2016=function _hasNonWS(value){return test.call(nonWSregex2016,value)},nonWSregex2018=new Rx("[\x85\u180e\u200b\ufffe]","g"),hasNonWS2018=function _hasNonWS(value){return test.call(nonWSregex2018,value)},invalidHexLiteral=/^[-+]0x[0-9a-f]+$/i,isInvalidHexLiteral=function _isInvalidHexLiteral(value){return test.call(invalidHexLiteral,value)},$toNumber2018=function toNumber2018(argument){var value=toPrimitive(argument,Number);if("symbol"==typeof value)throw new TypeError("Cannot convert a Symbol value to a number");if("string"==typeof value){if(isBinary(value))return toNumber2018($parseInt2018(pStrSlice.call(value,2),2));if(isOctal(value))return toNumber2018($parseInt2018(pStrSlice.call(value,2),8));if(hasNonWS2018(value)||isInvalidHexLiteral(value))return NAN;var trimmed=trim2018(value);if(trimmed!==value)return toNumber2018(trimmed)}return castNumber(value)};module.exports={toNumber:$toNumber2018,toNumber2016:function toNumber2016(argument){var value=toPrimitive(argument,Number);if("symbol"==typeof value)throw new TypeError("Cannot convert a Symbol value to a number");if("string"==typeof value){if(isBinary(value))return toNumber2016($parseInt2016(pStrSlice.call(value,2),2));if(isOctal(value))return toNumber2016($parseInt2016(pStrSlice.call(value,2),8));if(hasNonWS2016(value)||isInvalidHexLiteral(value))return NAN;var trimmed=trim2016(value);if(trimmed!==value)return toNumber2016(trimmed)}return castNumber(value)},toNumber2018:$toNumber2018}},{"cached-constructors-x":3,"nan-x":18,"parse-int-x":20,"to-primitive-x":27,"trim-x":32}],27:[function(_dereq_,module,exports){/** | ||
* @file Converts a JavaScript object to a primitive value. | ||
* @version 1.0.1 | ||
* @version 1.1.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -132,6 +196,6 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var hasSymbols=_dereq_("has-symbol-support-x"),isPrimitive=_dereq_("is-primitive"),isDate=_dereq_("is-date-object"),isSymbol=_dereq_("is-symbol"),isFunction=_dereq_("is-function-x"),requireObjectCoercible=_dereq_("require-object-coercible-x"),isNil=_dereq_("is-nil-x"),isUndefined=_dereq_("validate.io-undefined"),symToPrimitive=hasSymbols&&Symbol.toPrimitive,symValueOf=hasSymbols&&Symbol.prototype.valueOf,toStringOrder=["toString","valueOf"],toNumberOrder=["valueOf","toString"],ordinaryToPrimitive=function _ordinaryToPrimitive(O,hint){if(requireObjectCoercible(O),"string"!=typeof hint||"number"!==hint&&"string"!==hint)throw new TypeError('hint must be "string" or "number"');for(var method,result,methodNames="string"===hint?toStringOrder:toNumberOrder,i=0;i<2;i+=1)if(method=O[methodNames[i]],isFunction(method)&&(result=method.call(O),isPrimitive(result)))return result;throw new TypeError("No default value")},getMethod=function _getMethod(O,P){var func=O[P];if(!1===isNil(func)){if(!1===isFunction(func))throw new TypeError(func+" returned for property "+P+" of object "+O+" is not a function");return func}};module.exports=function toPrimitive(input,preferredType){if(isPrimitive(input))return input;var hint="default";arguments.length>1&&(preferredType===String?hint="string":preferredType===Number&&(hint="number"));var exoticToPrim;if(hasSymbols&&(symToPrimitive?exoticToPrim=getMethod(input,symToPrimitive):isSymbol(input)&&(exoticToPrim=symValueOf)),!1===isUndefined(exoticToPrim)){var result=exoticToPrim.call(input,hint);if(isPrimitive(result))return result;throw new TypeError("unable to convert exotic object to primitive")}return"default"===hint&&(isDate(input)||isSymbol(input))&&(hint="string"),ordinaryToPrimitive(input,"default"===hint?"number":hint)}},{"has-symbol-support-x":2,"is-date-object":4,"is-function-x":6,"is-nil-x":8,"is-primitive":9,"is-symbol":11,"require-object-coercible-x":17,"validate.io-undefined":26}],21:[function(_dereq_,module,exports){/** | ||
"use strict";var hasSymbols=_dereq_("has-symbol-support-x"),isPrimitive=_dereq_("is-primitive"),isDate=_dereq_("is-date-object"),isSymbol=_dereq_("is-symbol"),isFunction=_dereq_("is-function-x"),requireObjectCoercible=_dereq_("require-object-coercible-x"),isNil=_dereq_("is-nil-x"),isUndefined=_dereq_("validate.io-undefined"),symToPrimitive=hasSymbols&&Symbol.toPrimitive,symValueOf=hasSymbols&&Symbol.prototype.valueOf,toStringOrder=["toString","valueOf"],toNumberOrder=["valueOf","toString"],ordinaryToPrimitive=function _ordinaryToPrimitive(O,hint){if(requireObjectCoercible(O),"string"!=typeof hint||"number"!==hint&&"string"!==hint)throw new TypeError('hint must be "string" or "number"');for(var method,result,methodNames="string"===hint?toStringOrder:toNumberOrder,i=0;i<2;i+=1)if(method=O[methodNames[i]],isFunction(method)&&(result=method.call(O),isPrimitive(result)))return result;throw new TypeError("No default value")},getMethod=function _getMethod(O,P){var func=O[P];if(!1===isNil(func)){if(!1===isFunction(func))throw new TypeError(func+" returned for property "+P+" of object "+O+" is not a function");return func}};module.exports=function toPrimitive(input,preferredType){if(isPrimitive(input))return input;var hint="default";arguments.length>1&&(preferredType===String?hint="string":preferredType===Number&&(hint="number"));var exoticToPrim;if(hasSymbols&&(symToPrimitive?exoticToPrim=getMethod(input,symToPrimitive):isSymbol(input)&&(exoticToPrim=symValueOf)),!1===isUndefined(exoticToPrim)){var result=exoticToPrim.call(input,hint);if(isPrimitive(result))return result;throw new TypeError("unable to convert exotic object to primitive")}return"default"===hint&&(isDate(input)||isSymbol(input))&&(hint="string"),ordinaryToPrimitive(input,"default"===hint?"number":hint)}},{"has-symbol-support-x":4,"is-date-object":7,"is-function-x":10,"is-nil-x":12,"is-primitive":13,"is-symbol":14,"require-object-coercible-x":23,"validate.io-undefined":33}],28:[function(_dereq_,module,exports){/** | ||
* @file Get an object's ES6 @@toStringTag. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring|19.1.3.6 Object.prototype.toString ( )} | ||
* @version 1.4.1 | ||
* @version 1.4.2 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -142,6 +206,6 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var isNull=_dereq_("lodash.isnull"),isUndefined=_dereq_("validate.io-undefined"),toStr=Object.prototype.toString;module.exports=function toStringTag(value){return isNull(value)?"[object Null]":isUndefined(value)?"[object Undefined]":toStr.call(value)}},{"lodash.isnull":12,"validate.io-undefined":26}],22:[function(_dereq_,module,exports){/** | ||
"use strict";var isNull=_dereq_("lodash.isnull"),isUndefined=_dereq_("validate.io-undefined"),toStr={}.toString;module.exports=function toStringTag(value){return isNull(value)?"[object Null]":isUndefined(value)?"[object Undefined]":toStr.call(value)}},{"lodash.isnull":15,"validate.io-undefined":33}],29:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for ToString. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tostring|7.1.12 ToString ( argument )} | ||
* @version 1.4.1 | ||
* @version 1.4.2 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -152,5 +216,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var isSymbol=_dereq_("is-symbol");module.exports=function ToString(value){if(isSymbol(value))throw new TypeError("Cannot convert a Symbol value to a string");return String(value)}},{"is-symbol":11}],23:[function(_dereq_,module,exports){/** | ||
"use strict";var castString="".constructor,isSymbol=_dereq_("is-symbol");module.exports=function ToString(value){if(isSymbol(value))throw new TypeError("Cannot convert a Symbol value to a string");return castString(value)}},{"is-symbol":14}],30:[function(_dereq_,module,exports){/** | ||
* @file This method removes whitespace from the left end of a string. | ||
* @version 1.3.5 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -161,5 +225,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var $toString=_dereq_("to-string-x"),reLeft=new RegExp("^["+_dereq_("white-space-x").string+"]+");module.exports=function trimLeft(string){return $toString(string).replace(reLeft,"")}},{"to-string-x":22,"white-space-x":27}],24:[function(_dereq_,module,exports){/** | ||
"use strict";var requireCoercibleToString=_dereq_("require-coercible-to-string-x"),Rx=_dereq_("cached-constructors-x").RegExp,reLeft2016=new Rx("^["+_dereq_("white-space-x").string2016+"]+"),reLeft2018=new Rx("^["+_dereq_("white-space-x").string2018+"]+"),replace="".replace,$trimLeft2018=function trimLeft2018(string){return replace.call(requireCoercibleToString(string),reLeft2018,"")};module.exports={trimLeft:$trimLeft2018,trimLeft2016:function trimLeft2016(string){return replace.call(requireCoercibleToString(string),reLeft2016,"")},trimLeft2018:$trimLeft2018}},{"cached-constructors-x":3,"require-coercible-to-string-x":22,"white-space-x":34}],31:[function(_dereq_,module,exports){/** | ||
* @file This method removes whitespace from the right end of a string. | ||
* @version 1.3.3 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -170,5 +234,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var $toString=_dereq_("to-string-x"),reRight=new RegExp("["+_dereq_("white-space-x").string+"]+$");module.exports=function trimRight(string){return $toString(string).replace(reRight,"")}},{"to-string-x":22,"white-space-x":27}],25:[function(_dereq_,module,exports){/** | ||
"use strict";var requireCoercibleToString=_dereq_("require-coercible-to-string-x"),Rx=_dereq_("cached-constructors-x").RegExp,reRight2016=new Rx("["+_dereq_("white-space-x").string2016+"]+$"),reRight2018=new Rx("["+_dereq_("white-space-x").string2018+"]+$"),replace="".replace,$trimRight2018=function trimRight2018(string){return replace.call(requireCoercibleToString(string),reRight2018,"")};module.exports={trimRight:$trimRight2018,trimRight2016:function trimRight2016(string){return replace.call(requireCoercibleToString(string),reRight2016,"")},trimRight2018:$trimRight2018}},{"cached-constructors-x":3,"require-coercible-to-string-x":22,"white-space-x":34}],32:[function(_dereq_,module,exports){/** | ||
* @file This method removes whitespace from the left and right end of a string. | ||
* @version 1.0.3 | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -179,5 +243,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var trimLeft=_dereq_("trim-left-x"),trimRight=_dereq_("trim-right-x");module.exports=function trim(string){return trimLeft(trimRight(string))}},{"trim-left-x":23,"trim-right-x":24}],26:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}],27:[function(_dereq_,module,exports){/** | ||
* @file List of ECMAScript5 white space characters. | ||
* @version 2.0.3 | ||
"use strict";var libTrimLeft=_dereq_("trim-left-x"),trimLeft2016=libTrimLeft.trimLeft2016,trimLeft2018=libTrimLeft.trimLeft2018,libTrimRight=_dereq_("trim-right-x"),trimRight2016=libTrimRight.trimRight2016,trimRight2018=libTrimRight.trimRight2016,$trim2018=function trim2018(string){return trimLeft2018(trimRight2018(string))};module.exports={trim:$trim2018,trim2016:function trim2016(string){return trimLeft2016(trimRight2016(string))},trim2018:$trim2018}},{"trim-left-x":30,"trim-right-x":31}],33:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}],34:[function(_dereq_,module,exports){/** | ||
* @file List of ECMAScript white space characters. | ||
* @version 3.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -188,2 +252,2 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";for(var list=[{code:9,description:"Tab",string:"\t"},{code:10,description:"Line Feed",string:"\n"},{code:11,description:"Vertical Tab",string:"\x0B"},{code:12,description:"Form Feed",string:"\f"},{code:13,description:"Carriage Return",string:"\r"},{code:32,description:"Space",string:" "},{code:160,description:"No-break space",string:"\xa0"},{code:5760,description:"Ogham space mark",string:"\u1680"},{code:6158,description:"Mongolian vowel separator",string:"\u180e"},{code:8192,description:"En quad",string:"\u2000"},{code:8193,description:"Em quad",string:"\u2001"},{code:8194,description:"En space",string:"\u2002"},{code:8195,description:"Em space",string:"\u2003"},{code:8196,description:"Three-per-em space",string:"\u2004"},{code:8197,description:"Four-per-em space",string:"\u2005"},{code:8198,description:"Six-per-em space",string:"\u2006"},{code:8199,description:"Figure space",string:"\u2007"},{code:8200,description:"Punctuation space",string:"\u2008"},{code:8201,description:"Thin space",string:"\u2009"},{code:8202,description:"Hair space",string:"\u200a"},{code:8232,description:"Line separator",string:"\u2028"},{code:8233,description:"Paragraph separator",string:"\u2029"},{code:8239,description:"Narrow no-break space",string:"\u202f"},{code:8287,description:"Medium mathematical space",string:"\u205f"},{code:12288,description:"Ideographic space",string:"\u3000"},{code:65279,description:"Byte Order Mark",string:"\ufeff"}],string="",length=list.length,i=0;i<length;i+=1)string+=list[i].string;module.exports={list:list,string:string}},{}]},{},[1])(1)}); | ||
"use strict";for(var list=[{code:9,description:"Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\t"},{code:10,description:"Line Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\n"},{code:11,description:"Vertical Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\x0B"},{code:12,description:"Form Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\f"},{code:13,description:"Carriage Return",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\r"},{code:32,description:"Space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:160,description:"No-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\xa0"},{code:5760,description:"Ogham space mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u1680"},{code:6158,description:"Mongolian vowel separator",es5:!0,es2015:!0,es2016:!0,es2017:!1,es2018:!1,string:"\u180e"},{code:8192,description:"En quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2000"},{code:8193,description:"Em quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2001"},{code:8194,description:"En space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2002"},{code:8195,description:"Em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2003"},{code:8196,description:"Three-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2004"},{code:8197,description:"Four-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2005"},{code:8198,description:"Six-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2006"},{code:8199,description:"Figure space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2007"},{code:8200,description:"Punctuation space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2008"},{code:8201,description:"Thin space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2009"},{code:8202,description:"Hair space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u200a"},{code:8232,description:"Line separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2028"},{code:8233,description:"Paragraph separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2029"},{code:8239,description:"Narrow no-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u202f"},{code:8287,description:"Medium mathematical space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u205f"},{code:12288,description:"Ideographic space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u3000"},{code:65279,description:"Byte Order Mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\ufeff"}],stringES2016="",stringES2018="",length=list.length,i=0;i<length;i+=1)list[i].es2016&&(stringES2016+=list[i].string),list[i].es2018&&(stringES2018+=list[i].string);module.exports={list:list,string:stringES2018,string5:stringES2016,string2015:stringES2016,string2016:stringES2016,string2017:stringES2018,string2018:stringES2018}},{}]},{},[1])(1)}); |
{ | ||
"name": "to-length-x", | ||
"version": "2.1.0", | ||
"description": "ES6-compliant shim for ToLength.", | ||
"version": "3.0.0", | ||
"description": "Shim for ToLength.", | ||
"homepage": "https://github.com/Xotic750/to-length-x", | ||
@@ -12,3 +12,2 @@ "author": { | ||
"keywords": [ | ||
"es6", | ||
"toLength", | ||
@@ -34,3 +33,3 @@ "module", | ||
"max-safe-integer": "^1.0.1", | ||
"to-integer-x": "^2.1.0" | ||
"to-integer-x": "^3.0.0" | ||
}, | ||
@@ -37,0 +36,0 @@ "devDependencies": { |
@@ -24,16 +24,28 @@ <a href="https://travis-ci.org/Xotic750/to-length-x" | ||
## to-length-x | ||
ES6-compliant shim for ToLength. | ||
Shim for ToLength. | ||
**See**: [7.1.15 ToLength ( argument )](http://www.ecma-international.org/ecma-262/6.0/#sec-tolength) | ||
**Version**: 2.1.0 | ||
**Version**: 3.0.0 | ||
**Author**: Xotic750 <Xotic750@gmail.com> | ||
**License**: [MIT](<https://opensource.org/licenses/MIT>) | ||
**Copyright**: Xotic750 | ||
<a name="exp_module_to-length-x--module.exports"></a> | ||
### `module.exports(value)` ⇒ <code>number</code> ⏏ | ||
* [to-length-x](#module_to-length-x) | ||
* [`.toLength`](#module_to-length-x.toLength) | ||
* [`.toLength2016`](#module_to-length-x.toLength2016) ⇒ <code>number</code> | ||
* [`.toLength2018`](#module_to-length-x.toLength2018) ⇒ <code>number</code> | ||
<a name="module_to-length-x.toLength"></a> | ||
### `to-length-x.toLength` | ||
Reference to toLength2018. | ||
**Kind**: static property of [<code>to-length-x</code>](#module_to-length-x) | ||
<a name="module_to-length-x.toLength2016"></a> | ||
### `to-length-x.toLength2016` ⇒ <code>number</code> | ||
Converts `value` to an integer suitable for use as the length of an | ||
array-like object. | ||
array-like object. (ES2016) | ||
**Kind**: Exported function | ||
**Kind**: static property of [<code>to-length-x</code>](#module_to-length-x) | ||
**Returns**: <code>number</code> - Returns the converted integer. | ||
@@ -47,3 +59,3 @@ | ||
```js | ||
var toLength = require('to-length-x'); | ||
var toLength = require('to-length-x').toLength2016; | ||
toLength(3); // 3 | ||
@@ -54,1 +66,22 @@ toLength(Number.MIN_VALUE); // 0 | ||
``` | ||
<a name="module_to-length-x.toLength2018"></a> | ||
### `to-length-x.toLength2018` ⇒ <code>number</code> | ||
Converts `value` to an integer suitable for use as the length of an | ||
array-like object. (ES2018) | ||
**Kind**: static property of [<code>to-length-x</code>](#module_to-length-x) | ||
**Returns**: <code>number</code> - Returns the converted integer. | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| value | <code>\*</code> | The value to convert. | | ||
**Example** | ||
```js | ||
var toLength = require('to-length-x').toLength2018; | ||
toLength(3); // 3 | ||
toLength(Number.MIN_VALUE); // 0 | ||
toLength(Infinity); // Number.MAX_SAFE_INTEGER | ||
toLength('3'); // 3 | ||
``` |
Sorry, the diff of this file is not supported yet
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
119194
2346
85
+ Addedmath-sign-x@3.0.0(transitive)
+ Addedparse-int-x@2.0.0(transitive)
+ Addedto-integer-x@3.0.0(transitive)
+ Addedto-number-x@2.0.0(transitive)
- Removedmath-sign-x@2.1.0(transitive)
- Removedparse-int-x@1.1.0(transitive)
- Removedto-integer-x@2.1.0(transitive)
- Removedto-number-x@1.2.0(transitive)
- Removedtrim-left-x@2.0.1(transitive)
- Removedtrim-right-x@2.0.1(transitive)
- Removedtrim-x@2.0.2(transitive)
- Removedwhite-space-x@2.0.3(transitive)
Updatedto-integer-x@^3.0.0