SIGN IN SIGN UP

A modern JavaScript utility library delivering modularity, performance, & extras.

0 0 4 JavaScript
2015-01-08 00:37:01 -08:00
define([], function() {
2015-12-16 17:53:20 -08:00
/** Used for built-in method references. */
2015-01-08 00:37:01 -08:00
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
2018-02-02 21:16:59 -08:00
result = new array.constructor(length);
2015-01-08 00:37:01 -08:00
2015-12-16 17:53:20 -08:00
// Add properties assigned by `RegExp#exec`.
2015-01-08 00:37:01 -08:00
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
return initCloneArray;
});