Package Exports
- @writetome51/array-get-merged-arrays
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/array-get-merged-arrays) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
getMergedArrays(theArrays): any[]
Returns all arrays inside theArrays connected into one array.
The source array ( theArrays ) does not get modified.
NOTICE: This function is tested to merge up to 120,000 arrays in one call.
If you go higher than that, you may get a 'maximum call stack' error.
Examples
let theArrays = [ [1,2], [3,4], [5,6], [7,8] ];
let merged = getMergedArrays(theArrays);
// merged is now [1,2,3,4,5,6,7,8]
// It does not flatten deeply nested arrays:
let theArrays = [ [1,2], [ [3,4], [5,6] ], [7,8] ];
let merged = getMergedArrays(theArrays);
// merged is now [1, 2, [3,4], [5,6], 7, 8]Installation
npm i @writetome51/array-get-merged-arrays
Loading
// if using Typescript:
import {getMergedArrays} from '@writetome51/array-get-merged-arrays';
// if using ES5 Javascript:
var getMergedArrays = require('@writetome51/array-get-merged-arrays').getMergedArrays;