merge-arrays
v1.0.4
Published
A JavaScript Package For Merging multiple arrays.
Downloads
47
Readme
merge-arrays
A JavaScript Package For Merging multiple arrays.
Features
npm
Install
npm install --save merge-arrays
Script Tag
For Development
<script src="https://rawgit.com/Prosen-Ghosh/merge-arrays/master/merge.js"></script>
For Production
<script src="https://cdn.rawgit.com/Prosen-Ghosh/merge-arrays/60168dfe/merge.js"></script>
Usage
const merge = require('merge-arrays');
merge([],[]);
//=> []
merge([1,2],[3,4]);
//=> [ 1, 2, 3, 4 ]
merge([1],[2],[3,4],[5],[6,7,8],[9],[10,11]);
//=> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
merge(["foo","bar"],["baz","bob"]);
//=> [ 'foo', 'bar', 'baz', 'bob' ]
merge([1,2,3],[{a : 1}],["bob","foo"],[[100,101],["baz","tim"]]);
//=> [ 1, 2, 3, { a: 1 }, 'bob', 'foo', [ 100, 101 ], [ 'baz', 'tim' ] ]
merge([]);
//=> Error: expect at least 2 argument
merge([],{});
//=> TypeError: expets array arguments got object
merge([],function(){});
//=> TypeError: expets array arguments got function
Author
Prosen Ghosh [email protected] (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)
License
- MIT