UNPKG

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