Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

math-sign-x

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-sign-x - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0

57

index.js
/**
* @file ES6-compliant 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 1.3.0
* @version 2.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -13,9 +13,35 @@ * @copyright Xotic750

var $isNaN = require('is-nan');
var toNumber = require('to-number-x');
var nativeSign = typeof Math.sign === 'function' && Math.sign;
var $sign;
if (typeof Math.sign === 'function') {
if (nativeSign) {
try {
if (Math.sign(10) === 1 && Math.sign(-10) === -1 && Math.sign(0) === 0) {
$sign = Math.sign;
if (nativeSign(-10) === -1 && nativeSign(10) === 1 && 1 / nativeSign(-0) === 1 / -0) {
var nonWS = [
'\u0085',
'\u200b',
'\ufffe'
];
var lacksOctalSupport = nativeSign('0o10') !== 1;
var lacksBinarySupport = nativeSign('0b10') !== 1;
var trimsNonWhitespace;
for (var i = 0; i < nonWS.length; i += 1) {
var c = nonWS[i];
trimsNonWhitespace = nativeSign(c + 0 + c) === 0;
// eslint-disable-next-line max-depth
if (trimsNonWhitespace) {
// eslint-disable-next-line no-restricted-syntax
break;
}
}
if (lacksOctalSupport || lacksBinarySupport || trimsNonWhitespace) {
$sign = function sign(x) {
return nativeSign(toNumber(x));
};
} else {
$sign = nativeSign;
}
}

@@ -25,2 +51,14 @@ } catch (ignore) {}

if (Boolean($sign) === false) {
var numberIsNaN = require('is-nan');
$sign = function sign(x) {
var n = toNumber(x);
if (n === 0 || numberIsNaN(n)) {
return n;
}
return n > 0 ? 1 : -1;
};
}
/**

@@ -46,9 +84,2 @@ * This method returns the sign of a number, indicating whether the number is positive,

*/
module.exports = $sign || function sign(x) {
var n = Number(x);
if (n === 0 || $isNaN(n)) {
return n;
}
return n > 0 ? 1 : -1;
};
module.exports = $sign;

@@ -5,3 +5,3 @@ (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){

* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-math.sign|20.2.2.29 Math.sign(x)}
* @version 1.3.0
* @version 2.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -15,9 +15,35 @@ * @copyright Xotic750

var $isNaN = _dereq_('is-nan');
var toNumber = _dereq_('to-number-x');
var nativeSign = typeof Math.sign === 'function' && Math.sign;
var $sign;
if (typeof Math.sign === 'function') {
if (nativeSign) {
try {
if (Math.sign(10) === 1 && Math.sign(-10) === -1 && Math.sign(0) === 0) {
$sign = Math.sign;
if (nativeSign(-10) === -1 && nativeSign(10) === 1 && 1 / nativeSign(-0) === 1 / -0) {
var nonWS = [
'\u0085',
'\u200b',
'\ufffe'
];
var lacksOctalSupport = nativeSign('0o10') !== 1;
var lacksBinarySupport = nativeSign('0b10') !== 1;
var trimsNonWhitespace;
for (var i = 0; i < nonWS.length; i += 1) {
var c = nonWS[i];
trimsNonWhitespace = nativeSign(c + 0 + c) === 0;
// eslint-disable-next-line max-depth
if (trimsNonWhitespace) {
// eslint-disable-next-line no-restricted-syntax
break;
}
}
if (lacksOctalSupport || lacksBinarySupport || trimsNonWhitespace) {
$sign = function sign(x) {
return nativeSign(toNumber(x));
};
} else {
$sign = nativeSign;
}
}

@@ -27,2 +53,14 @@ } catch (ignore) {}

if (Boolean($sign) === false) {
var numberIsNaN = _dereq_('is-nan');
$sign = function sign(x) {
var n = toNumber(x);
if (n === 0 || numberIsNaN(n)) {
return n;
}
return n > 0 ? 1 : -1;
};
}
/**

@@ -48,12 +86,5 @@ * This method returns the sign of a number, indicating whether the number is positive,

*/
module.exports = $sign || function sign(x) {
var n = Number(x);
if (n === 0 || $isNaN(n)) {
return n;
}
module.exports = $sign;
return n > 0 ? 1 : -1;
};
},{"is-nan":5}],2:[function(_dereq_,module,exports){
},{"is-nan":9,"to-number-x":22}],2:[function(_dereq_,module,exports){
'use strict';

@@ -116,3 +147,3 @@

},{"foreach":3,"object-keys":8}],3:[function(_dereq_,module,exports){
},{"foreach":3,"object-keys":18}],3:[function(_dereq_,module,exports){

@@ -142,4 +173,172 @@ var hasOwn = Object.prototype.hasOwnProperty;

},{}],4:[function(_dereq_,module,exports){
/**
* @file Tests if ES6 Symbol is supported.
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module has-symbol-support-x
*/
'use strict';
/**
* Indicates if `Symbol`exists and creates the correct type.
* `true`, if it exists and creates the correct type, otherwise `false`.
*
* @type boolean
*/
module.exports = typeof Symbol === 'function' && typeof Symbol('') === 'symbol';
},{}],5:[function(_dereq_,module,exports){
/**
* @file Tests if ES6 @@toStringTag is supported.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-@@tostringtag|26.3.1 @@toStringTag}
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module has-to-string-tag-x
*/
'use strict';
/**
* Indicates if `Symbol.toStringTag`exists and is the correct type.
* `true`, if it exists and is the correct type, otherwise `false`.
*
* @type boolean
*/
module.exports = _dereq_('has-symbol-support-x') && typeof Symbol.toStringTag === 'symbol';
},{"has-symbol-support-x":4}],6:[function(_dereq_,module,exports){
'use strict';
var getDay = Date.prototype.getDay;
var tryDateObject = function tryDateObject(value) {
try {
getDay.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var dateClass = '[object Date]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isDateObject(value) {
if (typeof value !== 'object' || value === null) { return false; }
return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
};
},{}],7:[function(_dereq_,module,exports){
/**
* @file Determine whether a given value is a function object.
* @version 3.1.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module is-function-x
*/
'use strict';
var fToString = Function.prototype.toString;
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 deComment = _dereq_('replace-comments-x');
var funcTag = '[object Function]';
var genTag = '[object GeneratorFunction]';
var asyncTag = '[object AsyncFunction]';
var hasNativeClass = true;
try {
// eslint-disable-next-line no-new-func
Function('"use strict"; return class My {};')();
} catch (ignore) {
hasNativeClass = false;
}
var ctrRx = /^class /;
var isES6ClassFn = function isES6ClassFunc(value) {
try {
return ctrRx.test(normalise(deComment(fToString.call(value), ' ')));
} catch (ignore) {}
// not a function
return false;
};
/**
* Checks if `value` is classified as a `Function` object.
*
* @private
* @param {*} value - The value to check.
* @param {boolean} allowClass - Whether to filter ES6 classes.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
*/
var tryFuncToString = function funcToString(value, allowClass) {
try {
if (hasNativeClass && allowClass === false && isES6ClassFn(value)) {
return false;
}
fToString.call(value);
return true;
} catch (ignore) {}
return false;
};
/**
* Checks if `value` is classified as a `Function` object.
*
* @param {*} value - The value to check.
* @param {boolean} [allowClass=false] - Whether to filter ES6 classes.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
* @example
* var isFunction = require('is-function-x');
*
* isFunction(); // false
* isFunction(Number.MIN_VALUE); // false
* isFunction('abc'); // false
* isFunction(true); // false
* isFunction({ name: 'abc' }); // false
* isFunction(function () {}); // true
* isFunction(new Function ()); // true
* isFunction(function* test1() {}); // true
* isFunction(function test2(a, b) {}); // true
* isFunction(async function test3() {}); // true
* isFunction(class Test {}); // false
* isFunction(class Test {}, true); // true
* isFunction((x, y) => {return this;}); // true
*/
module.exports = function isFunction(value) {
if (isPrimitive(value)) {
return false;
}
var allowClass = arguments.length > 0 ? Boolean(arguments[1]) : false;
if (hasToStringTag) {
return tryFuncToString(value, allowClass);
}
if (hasNativeClass && allowClass === false && isES6ClassFn(value)) {
return false;
}
var strTag = toStringTag(value);
return strTag === funcTag || strTag === genTag || strTag === asyncTag;
};
},{"has-to-string-tag-x":5,"is-primitive":13,"normalize-space-x":17,"replace-comments-x":20,"to-string-tag-x":24}],8:[function(_dereq_,module,exports){
'use strict';
/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */

@@ -151,3 +350,3 @@

},{}],5:[function(_dereq_,module,exports){
},{}],9:[function(_dereq_,module,exports){
'use strict';

@@ -171,3 +370,3 @@

},{"./implementation":4,"./polyfill":6,"./shim":7,"define-properties":2}],6:[function(_dereq_,module,exports){
},{"./implementation":8,"./polyfill":10,"./shim":11,"define-properties":2}],10:[function(_dereq_,module,exports){
'use strict';

@@ -184,3 +383,3 @@

},{"./implementation":4}],7:[function(_dereq_,module,exports){
},{"./implementation":8}],11:[function(_dereq_,module,exports){
'use strict';

@@ -199,5 +398,165 @@

},{"./polyfill":6,"define-properties":2}],8:[function(_dereq_,module,exports){
},{"./polyfill":10,"define-properties":2}],12:[function(_dereq_,module,exports){
/**
* @file Checks if `value` is `null` or `undefined`.
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module is-nil-x
*/
'use strict';
var isUndefined = _dereq_('validate.io-undefined');
var isNull = _dereq_('lodash.isnull');
/**
* Checks if `value` is `null` or `undefined`.
*
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
* @example
* var isNil = require('is-nil-x');
*
* isNil(null); // => true
* isNil(void 0); // => true
* isNil(NaN); // => false
*/
module.exports = function isNil(value) {
return isNull(value) || isUndefined(value);
};
},{"lodash.isnull":16,"validate.io-undefined":29}],13:[function(_dereq_,module,exports){
/*!
* is-primitive <https://github.com/jonschlinkert/is-primitive>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
// see http://jsperf.com/testing-value-is-primitive/7
module.exports = function isPrimitive(value) {
return value == null || (typeof value !== 'function' && typeof value !== 'object');
};
},{}],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;
};
},{}],15:[function(_dereq_,module,exports){
'use strict';
var toStr = Object.prototype.toString;
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
if (hasSymbols) {
var symToStr = Symbol.prototype.toString;
var symStringRegex = /^Symbol\(.*\)$/;
var isSymbolObject = function isSymbolObject(value) {
if (typeof value.valueOf() !== 'symbol') { return false; }
return symStringRegex.test(symToStr.call(value));
};
module.exports = function isSymbol(value) {
if (typeof value === 'symbol') { return true; }
if (toStr.call(value) !== '[object Symbol]') { return false; }
try {
return isSymbolObject(value);
} catch (e) {
return false;
}
};
} else {
module.exports = function isSymbol(value) {
// this environment does not support Symbols.
return false;
};
}
},{}],16:[function(_dereq_,module,exports){
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* Checks if `value` is `null`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
* @example
*
* _.isNull(null);
* // => true
*
* _.isNull(void 0);
* // => false
*/
function isNull(value) {
return value === null;
}
module.exports = isNull;
},{}],17:[function(_dereq_,module,exports){
/**
* @file Trims and replaces sequences of whitespace characters by a single space.
* @version 1.3.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module normalize-space-x
*/
'use strict';
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.
*
* @param {string} string - The string to be normalized.
* @returns {string} The normalized string.
* @example
* var normalizeSpace = require('normalize-space-x');
*
* normalizeSpace(' \t\na \t\nb \t\n') === 'a b'; // true
*/
module.exports = function normalizeSpace(string) {
return trim(string).replace(reNormalize, ' ');
};
},{"trim-x":28,"white-space-x":30}],18:[function(_dereq_,module,exports){
'use strict';
// modified from https://github.com/es-shims/es5-shim

@@ -342,3 +701,3 @@ var has = Object.prototype.hasOwnProperty;

},{"./isArguments":9}],9:[function(_dereq_,module,exports){
},{"./isArguments":19}],19:[function(_dereq_,module,exports){
'use strict';

@@ -362,3 +721,724 @@

},{}],20:[function(_dereq_,module,exports){
/**
* @file Replace the comments in a string.
* @version 1.0.1
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module replace-comments-x
*/
'use strict';
var isString = _dereq_('is-string');
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var $replaceComments = function replaceComments(string) {
var replacement = arguments.length > 1 && isString(arguments[1]) ? arguments[1] : '';
return isString(string) ? string.replace(STRIP_COMMENTS, replacement) : '';
};
/**
* This method replaces comments in a string.
*
* @param {string} string - The string to be stripped.
* @param {string} [replacement] - The string to be used as a replacement.
* @returns {string} The new string with the comments replaced.
* @example
* var replaceComments = require('replace-comments-x');
*
* replaceComments(test;/* test * /, ''), // 'test;'
* replaceComments(test; // test, ''), // 'test;'
*/
module.exports = $replaceComments;
},{"is-string":14}],21:[function(_dereq_,module,exports){
/**
* @file ES6-compliant shim for RequireObjectCoercible.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible|7.2.1 RequireObjectCoercible ( argument )}
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module require-object-coercible-x
*/
'use strict';
var isNil = _dereq_('is-nil-x');
/**
* The abstract operation RequireObjectCoercible throws an error if argument
* is a value that cannot be converted to an Object using ToObject.
*
* @param {*} value - The `value` to check.
* @throws {TypeError} If `value` is a `null` or `undefined`.
* @returns {string} The `value`.
* @example
* var RequireObjectCoercible = require('require-object-coercible-x');
*
* RequireObjectCoercible(); // TypeError
* RequireObjectCoercible(null); // TypeError
* RequireObjectCoercible('abc'); // 'abc'
* RequireObjectCoercible(true); // true
* RequireObjectCoercible(Symbol('foo')); // Symbol('foo')
*/
module.exports = function RequireObjectCoercible(value) {
if (isNil(value)) {
throw new TypeError('Cannot call method on ' + value);
}
return value;
};
},{"is-nil-x":12}],22:[function(_dereq_,module,exports){
/**
* @file Converts argument to a value of type Number.
* @version 1.0.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-number-x
*/
'use strict';
var toPrimitive = _dereq_('to-primitive-x');
var isPrimitive = _dereq_('is-primitive');
var trim = _dereq_('trim-x');
var pStrSlice = String.prototype.slice;
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.
var test = binaryRegex.test;
var isBinary = function _isBinary(value) {
return test.call(binaryRegex, value);
};
var octalRegex = /^0o[0-7]+$/i;
var isOctal = function _isOctal(value) {
return test.call(octalRegex, value);
};
var nonWS = [
'\u0085',
'\u200b',
'\ufffe'
].join('');
var nonWSregex = new RegExp('[' + nonWS + ']', 'g');
var hasNonWS = function _hasNonWS(value) {
return test.call(nonWSregex, value);
};
var invalidHexLiteral = /^[-+]0x[0-9a-f]+$/i;
var isInvalidHexLiteral = function (value) {
return test.call(invalidHexLiteral, value);
};
var $toNumber = function toNumber(argument) {
var value = isPrimitive(argument) ? argument : toPrimitive(argument, 'number');
if (typeof value === 'symbol') {
throw new TypeError('Cannot convert a Symbol value to a number');
}
if (typeof value === 'string') {
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);
};
/**
* This method converts argument to a value of type 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;
},{"is-primitive":13,"to-primitive-x":23,"trim-x":28}],23:[function(_dereq_,module,exports){
/**
* @file Converts a JavaScript object to a primitive value.
* @version 1.0.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-primitive-x
*/
'use strict';
var hasSymbols = _dereq_('has-symbol-support-x');
var isPrimitive = _dereq_('is-primitive');
var isFunction = _dereq_('is-function-x');
var isDate = _dereq_('is-date-object');
var isSymbol = _dereq_('is-symbol');
var requireObjectCoercible = _dereq_('require-object-coercible-x');
var isNil = _dereq_('is-nil-x');
var isUndefined = _dereq_('validate.io-undefined');
var symToPrimitive = hasSymbols && Symbol.toPrimitive;
var symValueOf = hasSymbols && Symbol.prototype.valueOf;
var toStringOrder = ['toString', 'valueOf'];
var toNumberOrder = ['valueOf', 'toString'];
var orderLength = 2;
var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
requireObjectCoercible(O);
if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) {
throw new TypeError('hint must be "string" or "number"');
}
var methodNames = hint === 'string' ? toStringOrder : toNumberOrder;
var method;
var result;
for (var i = 0; i < orderLength; i += 1) {
method = O[methodNames[i]];
if (isFunction(method)) {
result = method.call(O);
if (isPrimitive(result)) {
return result;
}
}
}
throw new TypeError('No default value');
};
var getMethod = function GetMethod(O, P) {
var func = O[P];
if (isNil(func) === false) {
if (isFunction(func) === false) {
throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
}
return func;
}
return void 0;
};
// http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive
var $toPrimitive = function toPrimitive(input, preferredType) {
if (isPrimitive(input)) {
return input;
}
var hint = 'default';
if (arguments.length > 1) {
if (preferredType === String) {
hint = 'string';
} else if (preferredType === Number) {
hint = 'number';
}
}
var exoticToPrim;
if (hasSymbols) {
if (symToPrimitive) {
exoticToPrim = getMethod(input, symToPrimitive);
} else if (isSymbol(input)) {
exoticToPrim = symValueOf;
}
}
if (isUndefined(exoticToPrim) === false) {
var result = exoticToPrim.call(input, hint);
if (isPrimitive(result)) {
return result;
}
throw new TypeError('unable to convert exotic object to primitive');
}
if (hint === 'default' && (isDate(input) || isSymbol(input))) {
hint = 'string';
}
return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
};
/**
* This method converts a JavaScript object to a primitive value.
* Note: When toPrimitive is called with no hint, then it generally behaves as
* if the hint were Number. However, objects may over-ride this behaviour by
* defining a @@toPrimitive method. Of the objects defined in this specification
* only Date objects (see 20.3.4.45) and Symbol objects (see 19.4.3.4) over-ride
* the default ToPrimitive behaviour. Date objects treat no hint as if the hint
* were String.
*
* @param {*} input - The input to convert.
* @param {constructor} [prefferedtype] - The preffered type (String or Number).
* @throws {TypeError} If unable to convert input to a primitive.
* @returns {string|number} The converted input as a primitive.
* @example
* var toPrimitive = require('to-primitive-x');
*
* var date = new Date(0);
* toPrimitive(date)); // Thu Jan 01 1970 01:00:00 GMT+0100 (CET)
* toPrimitive(date, String)); // Thu Jan 01 1970 01:00:00 GMT+0100 (CET)
* toPrimitive(date, Number)); // 0
*/
module.exports = $toPrimitive;
},{"has-symbol-support-x":4,"is-date-object":6,"is-function-x":7,"is-nil-x":12,"is-primitive":13,"is-symbol":15,"require-object-coercible-x":21,"validate.io-undefined":29}],24:[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.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-string-tag-x
*/
'use strict';
var isNull = _dereq_('lodash.isnull');
var isUndefined = _dereq_('validate.io-undefined');
var toStr = Object.prototype.toString;
/**
* The `toStringTag` method returns "[object type]", where type is the
* object type.
*
* @param {*} value - The object of which to get the object type string.
* @returns {string} The object type string.
* @example
* var toStringTag = require('to-string-tag-x');
*
* var o = new Object();
* toStringTag(o); // returns '[object Object]'
*/
module.exports = function toStringTag(value) {
if (isNull(value)) {
return '[object Null]';
}
if (isUndefined(value)) {
return '[object Undefined]';
}
return toStr.call(value);
};
},{"lodash.isnull":16,"validate.io-undefined":29}],25:[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.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-string-x
*/
'use strict';
var isSymbol = _dereq_('is-symbol');
/**
* The abstract operation ToString converts argument to a value of type String.
*
* @param {*} value - The value to convert to a string.
* @throws {TypeError} If `value` is a Symbol.
* @returns {string} The converted value.
* @example
* var $toString = require('to-string-x');
*
* $toString(); // 'undefined'
* $toString(null); // 'null'
* $toString('abc'); // 'abc'
* $toString(true); // 'true'
* $toString(Symbol('foo')); // TypeError
* $toString(Symbol.iterator); // TypeError
* $toString(Object(Symbol.iterator)); // TypeError
*/
module.exports = function ToString(value) {
if (isSymbol(value)) {
throw new TypeError('Cannot convert a Symbol value to a string');
}
return String(value);
};
},{"is-symbol":15}],26:[function(_dereq_,module,exports){
/**
* @file This method removes whitespace from the left end of a string.
* @version 1.3.3
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module trim-left-x
*/
'use strict';
var $toString = _dereq_('to-string-x');
var reLeft = new RegExp('^[' + _dereq_('white-space-x').string + ']+');
/**
* 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, '');
};
},{"to-string-x":25,"white-space-x":30}],27:[function(_dereq_,module,exports){
/**
* @file This method removes whitespace from the right end of a string.
* @version 1.3.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module trim-right-x
*/
'use strict';
var $toString = _dereq_('to-string-x');
var reRight = new RegExp('[' + _dereq_('white-space-x').string + ']+$');
/**
* 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, '');
};
},{"to-string-x":25,"white-space-x":30}],28:[function(_dereq_,module,exports){
/**
* @file This method removes whitespace from the left and right end of a string.
* @version 1.0.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module trim-x
*/
'use strict';
var trimLeft = _dereq_('trim-left-x');
var trimRight = _dereq_('trim-right-x');
/**
* 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));
};
},{"trim-left-x":26,"trim-right-x":27}],29:[function(_dereq_,module,exports){
/**
*
* VALIDATE: undefined
*
*
* DESCRIPTION:
* - Validates if a value is undefined.
*
*
* NOTES:
* [1]
*
*
* TODO:
* [1]
*
*
* LICENSE:
* MIT
*
* Copyright (c) 2014. Athan Reines.
*
*
* AUTHOR:
* Athan Reines. kgryte@gmail.com. 2014.
*
*/
'use strict';
/**
* FUNCTION: isUndefined( value )
* Validates if a value is undefined.
*
* @param {*} value - value to be validated
* @returns {Boolean} boolean indicating whether value is undefined
*/
function isUndefined( value ) {
return value === void 0;
} // end FUNCTION isUndefined()
// EXPORTS //
module.exports = isUndefined;
},{}],30:[function(_dereq_,module,exports){
/**
* @file List of ECMAScript5 white space characters.
* @version 2.0.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module white-space-x
*/
'use strict';
/**
* An array of the ES5 whitespace char codes, string, and their descriptions.
*
* @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);
* });
*/
var list = [
{
code: 0x0009,
description: 'Tab',
string: '\u0009'
},
{
code: 0x000a,
description: 'Line Feed',
string: '\u000a'
},
{
code: 0x000b,
description: 'Vertical Tab',
string: '\u000b'
},
{
code: 0x000c,
description: 'Form Feed',
string: '\u000c'
},
{
code: 0x000d,
description: 'Carriage Return',
string: '\u000d'
},
{
code: 0x0020,
description: 'Space',
string: '\u0020'
},
/*
{
code: 0x0085,
description: 'Next line - Not ES5 whitespace',
string: '\u0085'
}
*/
{
code: 0x00a0,
description: 'No-break space',
string: '\u00a0'
},
{
code: 0x1680,
description: 'Ogham space mark',
string: '\u1680'
},
{
code: 0x180e,
description: 'Mongolian vowel separator',
string: '\u180e'
},
{
code: 0x2000,
description: 'En quad',
string: '\u2000'
},
{
code: 0x2001,
description: 'Em quad',
string: '\u2001'
},
{
code: 0x2002,
description: 'En space',
string: '\u2002'
},
{
code: 0x2003,
description: 'Em space',
string: '\u2003'
},
{
code: 0x2004,
description: 'Three-per-em space',
string: '\u2004'
},
{
code: 0x2005,
description: 'Four-per-em space',
string: '\u2005'
},
{
code: 0x2006,
description: 'Six-per-em space',
string: '\u2006'
},
{
code: 0x2007,
description: 'Figure space',
string: '\u2007'
},
{
code: 0x2008,
description: 'Punctuation space',
string: '\u2008'
},
{
code: 0x2009,
description: 'Thin space',
string: '\u2009'
},
{
code: 0x200a,
description: 'Hair space',
string: '\u200a'
},
/*
{
code: 0x200b,
description: 'Zero width space - Not ES5 whitespace',
string: '\u200b'
},
*/
{
code: 0x2028,
description: 'Line separator',
string: '\u2028'
},
{
code: 0x2029,
description: 'Paragraph separator',
string: '\u2029'
},
{
code: 0x202f,
description: 'Narrow no-break space',
string: '\u202f'
},
{
code: 0x205f,
description: 'Medium mathematical space',
string: '\u205f'
},
{
code: 0x3000,
description: 'Ideographic space',
string: '\u3000'
},
{
code: 0xfeff,
description: 'Byte Order Mark',
string: '\ufeff'
}
];
var string = '';
var length = list.length;
for (var i = 0; i < length; i += 1) {
string += 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 = {
list: list,
string: string
};
},{}]},{},[1])(1)
});
!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 Math.sign.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-math.sign|20.2.2.29 Math.sign(x)}
* @version 1.3.0
* @version 2.0.0
* @author Xotic750 <Xotic750@gmail.com>

@@ -10,2 +10,126 @@ * @copyright Xotic750

*/
"use strict";var $sign,$isNaN=_dereq_("is-nan");if("function"==typeof Math.sign)try{1===Math.sign(10)&&-1===Math.sign(-10)&&0===Math.sign(0)&&($sign=Math.sign)}catch(ignore){}module.exports=$sign||function sign(x){var n=Number(x);return 0===n||$isNaN(n)?n:n>0?1:-1}},{"is-nan":5}],2:[function(_dereq_,module,exports){"use strict";var keys=_dereq_("object-keys"),foreach=_dereq_("foreach"),hasSymbols="function"==typeof Symbol&&"symbol"==typeof Symbol(),toStr=Object.prototype.toString,isFunction=function(fn){return"function"==typeof fn&&"[object Function]"===toStr.call(fn)},supportsDescriptors=Object.defineProperty&&function(){var obj={};try{Object.defineProperty(obj,"x",{enumerable:!1,value:obj});for(var _ in obj)return!1;return obj.x===obj}catch(e){return!1}}(),defineProperty=function(object,name,value,predicate){(!(name in object)||isFunction(predicate)&&predicate())&&(supportsDescriptors?Object.defineProperty(object,name,{configurable:!0,enumerable:!1,value:value,writable:!0}):object[name]=value)},defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{},props=keys(map);hasSymbols&&(props=props.concat(Object.getOwnPropertySymbols(map))),foreach(props,function(name){defineProperty(object,name,map[name],predicates[name])})};defineProperties.supportsDescriptors=!!supportsDescriptors,module.exports=defineProperties},{foreach:3,"object-keys":8}],3:[function(_dereq_,module,exports){var hasOwn=Object.prototype.hasOwnProperty,toString=Object.prototype.toString;module.exports=function forEach(obj,fn,ctx){if("[object Function]"!==toString.call(fn))throw new TypeError("iterator must be a function");var l=obj.length;if(l===+l)for(var i=0;i<l;i++)fn.call(ctx,obj[i],i,obj);else for(var k in obj)hasOwn.call(obj,k)&&fn.call(ctx,obj[k],k,obj)}},{}],4:[function(_dereq_,module,exports){"use strict";module.exports=function isNaN(value){return value!==value}},{}],5:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),implementation=_dereq_("./implementation");define(implementation,{getPolyfill:_dereq_("./polyfill"),implementation:implementation,shim:_dereq_("./shim")}),module.exports=implementation},{"./implementation":4,"./polyfill":6,"./shim":7,"define-properties":2}],6:[function(_dereq_,module,exports){"use strict";var implementation=_dereq_("./implementation");module.exports=function getPolyfill(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:implementation}},{"./implementation":4}],7:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),getPolyfill=_dereq_("./polyfill");module.exports=function shimNumberIsNaN(){var polyfill=getPolyfill();return define(Number,{isNaN:polyfill},{isNaN:function(){return Number.isNaN!==polyfill}}),polyfill}},{"./polyfill":6,"define-properties":2}],8:[function(_dereq_,module,exports){"use strict";var has=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,slice=Array.prototype.slice,isArgs=_dereq_("./isArguments"),isEnumerable=Object.prototype.propertyIsEnumerable,hasDontEnumBug=!isEnumerable.call({toString:null},"toString"),hasProtoEnumBug=isEnumerable.call(function(){},"prototype"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o},excludedKeys={$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},hasAutomationEqualityBug=function(){if("undefined"==typeof window)return!1;for(var k in window)try{if(!excludedKeys["$"+k]&&has.call(window,k)&&null!==window[k]&&"object"==typeof window[k])try{equalsConstructorPrototype(window[k])}catch(e){return!0}}catch(e){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(o){if("undefined"==typeof window||!hasAutomationEqualityBug)return equalsConstructorPrototype(o);try{return equalsConstructorPrototype(o)}catch(e){return!1}},keysShim=function keys(object){var isObject=null!==object&&"object"==typeof object,isFunction="[object Function]"===toStr.call(object),isArguments=isArgs(object),isString=isObject&&"[object String]"===toStr.call(object),theKeys=[];if(!isObject&&!isFunction&&!isArguments)throw new TypeError("Object.keys called on a non-object");var skipProto=hasProtoEnumBug&&isFunction;if(isString&&object.length>0&&!has.call(object,0))for(var i=0;i<object.length;++i)theKeys.push(String(i));if(isArguments&&object.length>0)for(var j=0;j<object.length;++j)theKeys.push(String(j));else for(var name in object)skipProto&&"prototype"===name||!has.call(object,name)||theKeys.push(String(name));if(hasDontEnumBug)for(var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object),k=0;k<dontEnums.length;++k)skipConstructor&&"constructor"===dontEnums[k]||!has.call(object,dontEnums[k])||theKeys.push(dontEnums[k]);return theKeys};keysShim.shim=function shimObjectKeys(){if(Object.keys){if(!function(){return 2===(Object.keys(arguments)||"").length}(1,2)){var originalKeys=Object.keys;Object.keys=function keys(object){return originalKeys(isArgs(object)?slice.call(object):object)}}}else Object.keys=keysShim;return Object.keys||keysShim},module.exports=keysShim},{"./isArguments":9}],9:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;module.exports=function isArguments(value){var str=toStr.call(value),isArgs="[object Arguments]"===str;return isArgs||(isArgs="[object Array]"!==str&&null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&"[object Function]"===toStr.call(value.callee)),isArgs}},{}]},{},[1])(1)});
"use strict";var $sign,toNumber=_dereq_("to-number-x"),nativeSign="function"==typeof Math.sign&&Math.sign;if(nativeSign)try{if(-1===nativeSign(-10)&&1===nativeSign(10)&&1/nativeSign(-0)==-1/0){for(var trimsNonWhitespace,nonWS=["\x85","\u200b","\ufffe"],lacksOctalSupport=1!==nativeSign("0o10"),lacksBinarySupport=1!==nativeSign("0b10"),i=0;i<nonWS.length;i+=1){var c=nonWS[i];if(trimsNonWhitespace=0===nativeSign(c+0+c))break}$sign=lacksOctalSupport||lacksBinarySupport||trimsNonWhitespace?function sign(x){return nativeSign(toNumber(x))}:nativeSign}}catch(ignore){}if(!1===Boolean($sign)){var numberIsNaN=_dereq_("is-nan");$sign=function sign(x){var n=toNumber(x);return 0===n||numberIsNaN(n)?n:n>0?1:-1}}module.exports=$sign},{"is-nan":9,"to-number-x":22}],2:[function(_dereq_,module,exports){"use strict";var keys=_dereq_("object-keys"),foreach=_dereq_("foreach"),hasSymbols="function"==typeof Symbol&&"symbol"==typeof Symbol(),toStr=Object.prototype.toString,isFunction=function(fn){return"function"==typeof fn&&"[object Function]"===toStr.call(fn)},supportsDescriptors=Object.defineProperty&&function(){var obj={};try{Object.defineProperty(obj,"x",{enumerable:!1,value:obj});for(var _ in obj)return!1;return obj.x===obj}catch(e){return!1}}(),defineProperty=function(object,name,value,predicate){(!(name in object)||isFunction(predicate)&&predicate())&&(supportsDescriptors?Object.defineProperty(object,name,{configurable:!0,enumerable:!1,value:value,writable:!0}):object[name]=value)},defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{},props=keys(map);hasSymbols&&(props=props.concat(Object.getOwnPropertySymbols(map))),foreach(props,function(name){defineProperty(object,name,map[name],predicates[name])})};defineProperties.supportsDescriptors=!!supportsDescriptors,module.exports=defineProperties},{foreach:3,"object-keys":18}],3:[function(_dereq_,module,exports){var hasOwn=Object.prototype.hasOwnProperty,toString=Object.prototype.toString;module.exports=function forEach(obj,fn,ctx){if("[object Function]"!==toString.call(fn))throw new TypeError("iterator must be a function");var l=obj.length;if(l===+l)for(var i=0;i<l;i++)fn.call(ctx,obj[i],i,obj);else for(var k in obj)hasOwn.call(obj,k)&&fn.call(ctx,obj[k],k,obj)}},{}],4:[function(_dereq_,module,exports){/**
* @file Tests if ES6 Symbol is supported.
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module has-symbol-support-x
*/
"use strict";module.exports="function"==typeof Symbol&&"symbol"==typeof Symbol("")},{}],5:[function(_dereq_,module,exports){/**
* @file Tests if ES6 @@toStringTag is supported.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-@@tostringtag|26.3.1 @@toStringTag}
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module has-to-string-tag-x
*/
"use strict";module.exports=_dereq_("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag},{"has-symbol-support-x":4}],6:[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))}},{}],7:[function(_dereq_,module,exports){/**
* @file Determine whether a given value is a function object.
* @version 3.1.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module is-function-x
*/
"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":5,"is-primitive":13,"normalize-space-x":17,"replace-comments-x":20,"to-string-tag-x":24}],8:[function(_dereq_,module,exports){"use strict";module.exports=function isNaN(value){return value!==value}},{}],9:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),implementation=_dereq_("./implementation");define(implementation,{getPolyfill:_dereq_("./polyfill"),implementation:implementation,shim:_dereq_("./shim")}),module.exports=implementation},{"./implementation":8,"./polyfill":10,"./shim":11,"define-properties":2}],10:[function(_dereq_,module,exports){"use strict";var implementation=_dereq_("./implementation");module.exports=function getPolyfill(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:implementation}},{"./implementation":8}],11:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),getPolyfill=_dereq_("./polyfill");module.exports=function shimNumberIsNaN(){var polyfill=getPolyfill();return define(Number,{isNaN:polyfill},{isNaN:function(){return Number.isNaN!==polyfill}}),polyfill}},{"./polyfill":10,"define-properties":2}],12:[function(_dereq_,module,exports){/**
* @file Checks if `value` is `null` or `undefined`.
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module is-nil-x
*/
"use strict";var isUndefined=_dereq_("validate.io-undefined"),isNull=_dereq_("lodash.isnull");module.exports=function isNil(value){return isNull(value)||isUndefined(value)}},{"lodash.isnull":16,"validate.io-undefined":29}],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 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))}},{}],15:[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}},{}],16:[function(_dereq_,module,exports){module.exports=function isNull(value){return null===value}},{}],17:[function(_dereq_,module,exports){/**
* @file Trims and replaces sequences of whitespace characters by a single space.
* @version 1.3.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module normalize-space-x
*/
"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":28,"white-space-x":30}],18:[function(_dereq_,module,exports){"use strict";var has=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,slice=Array.prototype.slice,isArgs=_dereq_("./isArguments"),isEnumerable=Object.prototype.propertyIsEnumerable,hasDontEnumBug=!isEnumerable.call({toString:null},"toString"),hasProtoEnumBug=isEnumerable.call(function(){},"prototype"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o},excludedKeys={$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},hasAutomationEqualityBug=function(){if("undefined"==typeof window)return!1;for(var k in window)try{if(!excludedKeys["$"+k]&&has.call(window,k)&&null!==window[k]&&"object"==typeof window[k])try{equalsConstructorPrototype(window[k])}catch(e){return!0}}catch(e){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(o){if("undefined"==typeof window||!hasAutomationEqualityBug)return equalsConstructorPrototype(o);try{return equalsConstructorPrototype(o)}catch(e){return!1}},keysShim=function keys(object){var isObject=null!==object&&"object"==typeof object,isFunction="[object Function]"===toStr.call(object),isArguments=isArgs(object),isString=isObject&&"[object String]"===toStr.call(object),theKeys=[];if(!isObject&&!isFunction&&!isArguments)throw new TypeError("Object.keys called on a non-object");var skipProto=hasProtoEnumBug&&isFunction;if(isString&&object.length>0&&!has.call(object,0))for(var i=0;i<object.length;++i)theKeys.push(String(i));if(isArguments&&object.length>0)for(var j=0;j<object.length;++j)theKeys.push(String(j));else for(var name in object)skipProto&&"prototype"===name||!has.call(object,name)||theKeys.push(String(name));if(hasDontEnumBug)for(var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object),k=0;k<dontEnums.length;++k)skipConstructor&&"constructor"===dontEnums[k]||!has.call(object,dontEnums[k])||theKeys.push(dontEnums[k]);return theKeys};keysShim.shim=function shimObjectKeys(){if(Object.keys){if(!function(){return 2===(Object.keys(arguments)||"").length}(1,2)){var originalKeys=Object.keys;Object.keys=function keys(object){return originalKeys(isArgs(object)?slice.call(object):object)}}}else Object.keys=keysShim;return Object.keys||keysShim},module.exports=keysShim},{"./isArguments":19}],19:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;module.exports=function isArguments(value){var str=toStr.call(value),isArgs="[object Arguments]"===str;return isArgs||(isArgs="[object Array]"!==str&&null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&"[object Function]"===toStr.call(value.callee)),isArgs}},{}],20:[function(_dereq_,module,exports){/**
* @file Replace the comments in a string.
* @version 1.0.1
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module replace-comments-x
*/
"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":14}],21:[function(_dereq_,module,exports){/**
* @file ES6-compliant shim for RequireObjectCoercible.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible|7.2.1 RequireObjectCoercible ( argument )}
* @version 1.4.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module require-object-coercible-x
*/
"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}],22:[function(_dereq_,module,exports){/**
* @file Converts argument to a value of type Number.
* @version 1.0.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-number-x
*/
"use strict";var toPrimitive=_dereq_("to-primitive-x"),isPrimitive=_dereq_("is-primitive"),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(value){return test.call(invalidHexLiteral,value)},$toNumber=function toNumber(argument){var value=isPrimitive(argument)?argument: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},{"is-primitive":13,"to-primitive-x":23,"trim-x":28}],23:[function(_dereq_,module,exports){/**
* @file Converts a JavaScript object to a primitive value.
* @version 1.0.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-primitive-x
*/
"use strict";var hasSymbols=_dereq_("has-symbol-support-x"),isPrimitive=_dereq_("is-primitive"),isFunction=_dereq_("is-function-x"),isDate=_dereq_("is-date-object"),isSymbol=_dereq_("is-symbol"),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":6,"is-function-x":7,"is-nil-x":12,"is-primitive":13,"is-symbol":15,"require-object-coercible-x":21,"validate.io-undefined":29}],24:[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.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-string-tag-x
*/
"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":16,"validate.io-undefined":29}],25:[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.0
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-string-x
*/
"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":15}],26:[function(_dereq_,module,exports){/**
* @file This method removes whitespace from the left end of a string.
* @version 1.3.3
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module trim-left-x
*/
"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":25,"white-space-x":30}],27:[function(_dereq_,module,exports){/**
* @file This method removes whitespace from the right end of a string.
* @version 1.3.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module trim-right-x
*/
"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":25,"white-space-x":30}],28:[function(_dereq_,module,exports){/**
* @file This method removes whitespace from the left and right end of a string.
* @version 1.0.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module trim-x
*/
"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":26,"trim-right-x":27}],29:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}],30:[function(_dereq_,module,exports){/**
* @file List of ECMAScript5 white space characters.
* @version 2.0.2
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module white-space-x
*/
"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)});
{
"name": "math-sign-x",
"version": "1.3.0",
"version": "2.0.0",
"description": "ES6-compliant shim for Math.sign.",

@@ -32,3 +32,4 @@ "homepage": "https://github.com/Xotic750/math-sign-x",

"dependencies": {
"is-nan": "^1.2.1"
"is-nan": "^1.2.1",
"to-number-x": "^1.0.0"
},

@@ -35,0 +36,0 @@ "devDependencies": {

@@ -27,3 +27,3 @@ <a href="https://travis-ci.org/Xotic750/math-sign-x"

**See**: [20.2.2.29 Math.sign(x)](http://www.ecma-international.org/ecma-262/6.0/#sec-math.sign)
**Version**: 1.3.0
**Version**: 2.0.0
**Author**: Xotic750 <Xotic750@gmail.com>

@@ -30,0 +30,0 @@ **License**: [MIT](&lt;https://opensource.org/licenses/MIT&gt;)

@@ -49,3 +49,9 @@ 'use strict';

// we also verify that [[ToNumber]] is being called
[Infinity, 1].forEach(function (value) {
[
Infinity,
1,
'0o10',
'0b10',
' \t\r\n1 \t\r\n'
].forEach(function (value) {
expect(mathSign(value)).toBe(1);

@@ -71,2 +77,3 @@ expect(mathSign(String(value))).toBe(1);

expect(numberIsNaN(mathSign(NaN))).toBe(true);
expect(numberIsNaN(mathSign('\u0085\u200b\ufffe0\u0085\u200b\ufffe'))).toBe(true);
expect(numberIsNaN(mathSign('NaN'))).toBe(true);

@@ -73,0 +80,0 @@ expect(numberIsNaN(mathSign(undefined))).toBe(true);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc