Projekt

Obecné

Profil

Stáhnout (692 Bajtů) Statistiky
| Větev: | Revize:
1
/** Used for built-in method references. */
2
var objectProto = Object.prototype;
3

    
4
/** Used to check objects for own properties. */
5
var hasOwnProperty = objectProto.hasOwnProperty;
6

    
7
/**
8
 * Initializes an array clone.
9
 *
10
 * @private
11
 * @param {Array} array The array to clone.
12
 * @returns {Array} Returns the initialized clone.
13
 */
14
function initCloneArray(array) {
15
  var length = array.length,
16
      result = new array.constructor(length);
17

    
18
  // Add properties assigned by `RegExp#exec`.
19
  if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
20
    result.index = array.index;
21
    result.input = array.input;
22
  }
23
  return result;
24
}
25

    
26
module.exports = initCloneArray;
(218-218/590)