You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
241 B

4 years ago
  1. function cloneArray(array) {
  2. var cloned = array.slice(0);
  3. for (var i = 0, l = cloned.length; i < l; i++) {
  4. if (Array.isArray(cloned[i]))
  5. cloned[i] = cloneArray(cloned[i]);
  6. }
  7. return cloned;
  8. }
  9. module.exports = cloneArray;