array-moveto

0.1.2 • Public • Published

array-moveto

NOTE: array-moveto was renamed to @extra-array/move. NPM

Move part of array to another array.

const moveTo = require('array-moveto');
// moveTo(<array>, [clear=0], [begin=0], [end], [target=[]], [at], [till])
// -> <target>

moveTo(['p', 'o', 'r', 't']);
// ['p', 'o', 'r', 't'] (array: [0, 0, 0, 0])
moveTo(['p', 'o', 'r', 't'], null);
// ['p', 'o', 'r', 't'] (array: [null, null, null, null])
moveTo(['p', 'o', 'r', 't'], null, 1);
// ['o', 'r', 't']      (array: ['p', null, null, null])
moveTo(['p', 'o', 'r', 't'], null, 1, 3);
// ['o', 'r']           (array: ['p', null, null, 't'])
moveTo(['p', 'o', 'r', 't'], null, 1, 3, ['d', 'o']);
// ['d', 'o', 'o', 'r'] (array: ['p', null, null, 't'])
moveTo(['p', 'o', 'r', 't'], null, 1, 3, ['d', 'o'], 1);
// ['d', 'o', 'r']      (array: ['p', null, null, 't'])

Readme

Keywords

Package Sidebar

Install

npm i array-moveto

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

1.74 kB

Total Files

3

Last publish

Collaborators

  • wolfram77