source: trip-planner-front/node_modules/lodash/_initCloneArray.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 692 bytes
Line 
1/** Used for built-in method references. */
2var objectProto = Object.prototype;
3
4/** Used to check objects for own properties. */
5var 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 */
14function 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
26module.exports = initCloneArray;
Note: See TracBrowser for help on using the repository browser.