main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
690 bytes
|
Line | |
---|
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 | export default initCloneArray;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.