Skip to content

Commit 1658160

Browse files
committed
feature: deep copy of email
1 parent 14f1d2e commit 1658160

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ function sort_nums(arr, reverse = false) {
163163
}
164164
}
165165

166+
/**
167+
* Deep copy of array
168+
*
169+
* @param array arr
170+
* @returns array
171+
*/
172+
const array_copy = (arr) => arr.map(item => Array.isArray(item) ? array_copy(item) : item);
173+
166174
export {
167175
is_array,
168176
is_num_array,
@@ -178,4 +186,5 @@ export {
178186
array_sum,
179187
array_slice_sum,
180188
sort_nums,
189+
array_copy,
181190
};

0 commit comments

Comments
 (0)