UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

15 lines (12 loc) 271 B
'use strict'; function copyArray(source, array) { const length = source.length; if (array == null) { array = Array(length); } for (let i = 0; i < length; i++) { array[i] = source[i]; } return array; } module.exports = copyArray;