Lodash Internal Array Copy Utility

3.0.0 · abandoned · verified Sun Apr 19

lodash._arraycopy is a standalone npm package that provides the internal `arrayCopy` utility function from the Lodash library as a modularized component. This package was last updated with version 3.0.0, released in 2015, following semantic versioning practices for its specific release cycle. While the core `arrayCopy` functionality remains integral and actively maintained within the main Lodash library (which is currently at v4.x and receives regular updates and security patches), the `lodash._arraycopy` *npm package itself* is not independently maintained or updated. Its primary purpose was to expose an internal helper for environments that required modular consumption of Lodash's foundational utilities. For modern JavaScript projects, it is strongly recommended to use the comprehensive `lodash` or `lodash-es` packages, which encapsulate and maintain this functionality as part of a larger, actively developed codebase, rather than relying on this outdated standalone module.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the `arrayCopy` function to copy elements between arrays.

const arrayCopy = require('lodash._arraycopy');

const sourceArray = [1, 2, 3, 4, 5];
const destinationArray = new Array(sourceArray.length);
const sourceStart = 0;
const destinationStart = 0;
const length = sourceArray.length;

// Copies elements from sourceArray to destinationArray
arrayCopy(sourceArray, destinationArray, destinationStart, sourceStart, length);

console.log(destinationArray); // Expected: [1, 2, 3, 4, 5]

const anotherSource = ['a', 'b', 'c'];
const anotherDest = ['x', 'y', 'z', 'w'];
// Copy 'b', 'c' from anotherSource to anotherDest starting at index 1 of anotherDest
// anotherDest becomes ['x', 'b', 'c', 'w']
arrayCopy(anotherSource, anotherDest, 1, 1, 2);
console.log(anotherDest); // Expected: ['x', 'b', 'c', 'w']

view raw JSON →