Remove keyPrefix for using a simple _ prefix.

This commit is contained in:
John-David Dalton
2014-01-11 21:48:10 -08:00
parent e4aee13e9e
commit e9a15d9189
5 changed files with 150 additions and 167 deletions

41
dist/lodash.compat.js vendored
View File

@@ -19,12 +19,6 @@
/** Used to generate unique IDs */
var idCounter = 0;
/** Used internally to indicate various things */
var indicatorObject = {};
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
var keyPrefix = '__1335248838000__';
/** Used as the size when optimizations are enabled for large arrays */
var largeArraySize = 75;
@@ -230,8 +224,7 @@
}
/**
* The base implementation of `_.indexOf` without support for binary searches
* or `fromIndex` constraints.
* The base implementation of `_.indexOf` without support for binary searches.
*
* @private
* @param {Array} array The array to search.
@@ -270,7 +263,7 @@
if (type != 'number' && type != 'string') {
type = 'object';
}
var key = type == 'number' ? value : keyPrefix + value;
var key = type == 'number' ? value : '_' + value;
cache = (cache = cache[type]) && cache[key];
return type == 'object'
@@ -294,7 +287,7 @@
if (type != 'number' && type != 'string') {
type = 'object';
}
var key = type == 'number' ? value : keyPrefix + value,
var key = type == 'number' ? value : '_' + value,
typeCache = cache[type] || (cache[type] = {});
if (type == 'object') {
@@ -327,7 +320,7 @@
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the first non-whitespace character.
* @returns {number} Returns the index of the first character not found in `chars`.
*/
function charsLeftIndex(string, chars) {
var index = -1,
@@ -346,7 +339,7 @@
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the last non-whitespace character.
* @returns {number} Returns the index of the last character not found in `chars`.
*/
function charsRightIndex(string, chars) {
var index = string.length;
@@ -507,7 +500,7 @@
* Releases `array` back to the array pool.
*
* @private
* @param {Array} [array] The array to release.
* @param {Array} array The array to release.
*/
function releaseArray(array) {
array.length = 0;
@@ -520,7 +513,7 @@
* Releases `object` back to the object pool.
*
* @private
* @param {Object} [object] The object to release.
* @param {Object} object The object to release.
*/
function releaseObject(object) {
var cache = object.cache;
@@ -850,7 +843,7 @@
*
* @private
* @param {*} value The value to wrap in a `lodash` instance.
* @param {boolean} chainAll A flag to enable chaining for all methods
* @param {boolean} [chainAll=false] A flag to enable chaining for all methods
* @returns {Object} Returns a `lodash` instance.
*/
function lodashWrapper(value, chainAll) {
@@ -1280,7 +1273,7 @@
* @param {Object} prototype The object to inherit from.
* @returns {Object} Returns the new object.
*/
function baseCreate(prototype, properties) {
function baseCreate(prototype) {
return isObject(prototype) ? nativeCreate(prototype) : {};
}
// fallback for environments without `Object.create`
@@ -3830,7 +3823,7 @@
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|string} methodName The name of the method to invoke or
* the function invoked per iteration.
* @param {...*} [arg] Arguments to invoke the method with.
* @param {...*} [args] Arguments to invoke the method with.
* @returns {Array} Returns a new array of the results of each invoked method.
* @example
*
@@ -4536,7 +4529,7 @@
* @category Functions
* @param {Function} func The function to bind.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {...*} [arg] Arguments to be partially applied.
* @param {...*} [args] Arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
@@ -4605,7 +4598,7 @@
* @category Functions
* @param {Object} object The object the method belongs to.
* @param {string} key The key of the method.
* @param {...*} [arg] Arguments to be partially applied.
* @param {...*} [args] Arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
@@ -4866,7 +4859,7 @@
* @memberOf _
* @category Functions
* @param {Function} func The function to defer.
* @param {...*} [arg] Arguments to invoke the function with.
* @param {...*} [args] Arguments to invoke the function with.
* @returns {number} Returns the timer id.
* @example
*
@@ -4890,7 +4883,7 @@
* @category Functions
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay execution.
* @param {...*} [arg] Arguments to invoke the function with.
* @param {...*} [args] Arguments to invoke the function with.
* @returns {number} Returns the timer id.
* @example
*
@@ -4948,7 +4941,7 @@
}
var memoized = function() {
var cache = memoized.cache,
key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];
key = resolver ? resolver.apply(this, arguments) : '_' + arguments[0];
return hasOwnProperty.call(cache, key)
? cache[key]
@@ -5007,7 +5000,7 @@
* @memberOf _
* @category Functions
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [arg] Arguments to be partially applied.
* @param {...*} [args] Arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
@@ -5031,7 +5024,7 @@
* @memberOf _
* @category Functions
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [arg] Arguments to be partially applied.
* @param {...*} [args] Arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*