Move thrower from v4 to move to v3.

This commit is contained in:
John-David Dalton
2016-09-24 21:07:50 -07:00
parent 2026cbeebd
commit 55fb0172c0

View File

@@ -18,10 +18,8 @@
var LARGE_ARRAY_SIZE = 200; var LARGE_ARRAY_SIZE = 200;
/** Error message constants. */ /** Error message constants. */
var TRY_ES_SHIMS = 'Try https://github.com/es-shims.', var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://github.com/es-shims.',
CORE_ERROR_TEXT = 'Unsupported core-js use. ' + TRY_ES_SHIMS, FUNC_ERROR_TEXT = 'Expected a function';
FUNC_ERROR_TEXT = 'Expected a function',
SHIM_ERROR_TEXT = 'Unsupported method. ' + TRY_ES_SHIMS;
/** Used to stand-in for `undefined` hash values. */ /** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__'; var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -1333,19 +1331,6 @@
: asciiToArray(string); : asciiToArray(string);
} }
/**
* Creates a function that throws an error with `message`.
*
* @private
* @param {stirng} message The error message.
* @returns {Function} Returns the new thrower function.
*/
function thrower(message) {
return function() {
throw new Error(message);
};
}
/** /**
* Used by `_.unescape` to convert HTML entities to characters. * Used by `_.unescape` to convert HTML entities to characters.
* *
@@ -1501,14 +1486,13 @@
var nativeCeil = Math.ceil, var nativeCeil = Math.ceil,
nativeFloor = Math.floor, nativeFloor = Math.floor,
nativeGetSymbols = Object.getOwnPropertySymbols, nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsArray = Array.isArray || (Array.isArray = thrower(SHIM_ERROR_TEXT)),
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = context.isFinite, nativeIsFinite = context.isFinite,
nativeJoin = arrayProto.join, nativeJoin = arrayProto.join,
nativeKeys = overArg(Object.keys, Object), nativeKeys = overArg(Object.keys, Object),
nativeMax = Math.max, nativeMax = Math.max,
nativeMin = Math.min, nativeMin = Math.min,
nativeNow = Date.now || (Date.now = thrower(SHIM_ERROR_TEXT)), nativeNow = Date.now,
nativeParseInt = context.parseInt, nativeParseInt = context.parseInt,
nativeRandom = Math.random, nativeRandom = Math.random,
nativeReverse = arrayProto.reverse; nativeReverse = arrayProto.reverse;
@@ -11176,7 +11160,7 @@
* _.isArray(_.noop); * _.isArray(_.noop);
* // => false * // => false
*/ */
var isArray = nativeIsArray; var isArray = Array.isArray;
/** /**
* Checks if `value` is classified as an `ArrayBuffer` object. * Checks if `value` is classified as an `ArrayBuffer` object.