JSPM

@writetome51/get-array-copy

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q10353F
  • License MIT

Returns independent copy of a passed array

Package Exports

  • @writetome51/get-array-copy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@writetome51/get-array-copy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

getArrayCopy<T>(array: T[]): T[]

Returns an identical but independent copy of array, not referencing the original.

Example

let arr = [1,2,3,4,5];  
let copy = getArrayCopy(arr);  
copy.push(10); // copy === [1,2,3,4,5,10]

// But the original hasn't changed:
console.log(arr);
// [1,2,3,4,5]

Installation

npm i @writetome51/get-array-copy

Loading

import {getArrayCopy} from '@writetome51/get-array-copy';