{"_id":"array-move","_rev":"2812388","name":"array-move","description":"Move an array item to a different position","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2022-09-06T14:03:17.000Z","created":"2015-09-04T16:50:47.753Z","4.0.0":"2021-08-10T21:51:34.127Z","3.0.1":"2020-08-08T11:41:11.672Z","3.0.0":"2020-07-12T14:04:05.128Z","2.2.2":"2020-05-25T14:26:16.409Z","2.2.1":"2019-12-01T17:11:07.462Z","2.2.0":"2019-10-22T04:31:53.484Z","2.1.0":"2019-04-02T02:42:09.586Z","2.0.0":"2019-03-20T17:04:06.941Z","1.0.0":"2015-09-08T02:42:37.857Z","0.1.0":"2015-09-04T16:50:47.753Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"versions":{"4.0.0":{"name":"array-move","version":"4.0.0","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","xo":"^0.44.0"},"gitHead":"e810c3a4f825fe0aee930b3be95bb50cb084c9a9","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@4.0.0","_nodeVersion":"16.2.0","_npmVersion":"7.13.0","dist":{"shasum":"2c3730f056cc926f62a59769a5a8cda2fb6d8c55","size":1938,"noattachment":false,"key":"/array-move/-/array-move-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_4.0.0_1628632293986_0.6382584618365867"},"_hasShrinkwrap":false,"publish_time":1628632294127,"_cnpm_publish_time":1628632294127,"_cnpmcore_publish_time":"2021-12-16T10:06:34.700Z"},"3.0.1":{"name":"array-move","version":"3.0.1","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=10"},"scripts":{"test":"xo && ava && tsd"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^2.4.0","tsd":"^0.9.0","xo":"^0.25.3"},"gitHead":"03af3d2987e2a1fbb0c8c08ab5b3733c29658710","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@3.0.1","_nodeVersion":"14.5.0","_npmVersion":"6.14.7","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"179645cc0987b65953a4fc06b6df9045e4ba9618","size":2026,"noattachment":false,"key":"/array-move/-/array-move-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-3.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_3.0.1_1596886871548_0.5522972765629377"},"_hasShrinkwrap":false,"publish_time":1596886871672,"_cnpm_publish_time":1596886871672,"_cnpmcore_publish_time":"2021-12-16T10:06:34.928Z"},"3.0.0":{"name":"array-move","version":"3.0.0","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=10"},"scripts":{"test":"xo && ava && tsd"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^2.4.0","tsd":"^0.9.0","xo":"^0.25.3"},"gitHead":"ad75af1fb6dc1e74958bfbba3a85677050282a59","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@3.0.0","_nodeVersion":"14.5.0","_npmVersion":"6.14.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"b646a2f4980be78f04d28d7572a72036150d364e","size":2008,"noattachment":false,"key":"/array-move/-/array-move-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_3.0.0_1594562644976_0.6400207976405741"},"_hasShrinkwrap":false,"publish_time":1594562645128,"_cnpm_publish_time":1594562645128,"_cnpmcore_publish_time":"2021-12-16T10:06:35.149Z"},"2.2.2":{"name":"array-move","version":"2.2.2","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^2.4.0","tsd":"^0.9.0","xo":"^0.25.3"},"gitHead":"e4b7365346e4489841a4aaef671cd22a328cb1e1","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@2.2.2","_nodeVersion":"10.20.1","_npmVersion":"6.14.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"c125f84d64e2f4bc09147f91f900a1bf58bb25d1","size":2040,"noattachment":false,"key":"/array-move/-/array-move-2.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-2.2.2.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_2.2.2_1590416776293_0.5103364265225092"},"_hasShrinkwrap":false,"publish_time":1590416776409,"_cnpm_publish_time":1590416776409,"_cnpmcore_publish_time":"2021-12-16T10:06:35.491Z"},"2.2.1":{"name":"array-move","version":"2.2.1","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^2.4.0","tsd":"^0.9.0","xo":"^0.25.3"},"gitHead":"f3645e5b3ac7ad1d8fe42d380365a4c58c0b66b4","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@2.2.1","_nodeVersion":"10.17.0","_npmVersion":"6.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"16d5b68cb949c43e8821d63e4622f3a3336f254d","size":1959,"noattachment":false,"key":"/array-move/-/array-move-2.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-2.2.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_2.2.1_1575220267334_0.9117059312660383"},"_hasShrinkwrap":false,"publish_time":1575220267462,"_cnpm_publish_time":1575220267462,"_cnpmcore_publish_time":"2021-12-16T10:06:35.776Z"},"2.2.0":{"name":"array-move","version":"2.2.0","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^2.4.0","tsd":"^0.9.0","xo":"^0.25.3"},"gitHead":"27d179ec56f65044116051255c348a8f811f9b7c","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@2.2.0","_nodeVersion":"10.16.3","_npmVersion":"6.12.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"28f39b915df05ce8b00c43100d20b5a6385f7606","size":1910,"noattachment":false,"key":"/array-move/-/array-move-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-2.2.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_2.2.0_1571718713343_0.15599465858874284"},"_hasShrinkwrap":false,"publish_time":1571718713484,"_cnpm_publish_time":1571718713484,"_cnpmcore_publish_time":"2021-12-16T10:06:36.015Z"},"2.1.0":{"name":"array-move","version":"2.1.0","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.1","xo":"^0.24.0"},"gitHead":"629d1164b6631e146c3fbe8d5a4f77edee89a1b0","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@2.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"b4e9fc8d6a580bc97dcad408e0539c61b4b7ed7e","size":1912,"noattachment":false,"key":"/array-move/-/array-move-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_2.1.0_1554172929464_0.35918934901461586"},"_hasShrinkwrap":false,"publish_time":1554172929586,"_cnpm_publish_time":1554172929586,"_cnpmcore_publish_time":"2021-12-16T10:06:36.241Z"},"2.0.0":{"name":"array-move","version":"2.0.0","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-move.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["array","move","change","position","index"],"devDependencies":{"ava":"^1.3.1","tsd-check":"^0.6.0","xo":"^0.24.0"},"gitHead":"a9f625ee083d31feee0784a7beaebc3fd812f64e","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move#readme","_id":"array-move@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"4aa2262560ec75bae7a08a69e186ef80d439f770","size":1890,"noattachment":false,"key":"/array-move/-/array-move-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_2.0.0_1553101446765_0.2685224664016157"},"_hasShrinkwrap":false,"publish_time":1553101446941,"_cnpm_publish_time":1553101446941,"_cnpmcore_publish_time":"2021-12-16T10:06:36.504Z"},"1.0.0":{"name":"array-move","version":"1.0.0","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/array-move"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["array","arr","move","change","position","index"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"2246727d5cbf86d682a7cf62c876f89eb29c3cb2","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move","_id":"array-move@1.0.0","_shasum":"ec5de472cab0b9db3e50963fd71476ba477a6583","_from":".","_npmVersion":"2.13.3","_nodeVersion":"3.0.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"ec5de472cab0b9db3e50963fd71476ba477a6583","size":1665,"noattachment":false,"key":"/array-move/-/array-move-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1441680157857,"_hasShrinkwrap":false,"_cnpm_publish_time":1441680157857,"_cnpmcore_publish_time":"2021-12-16T10:06:36.683Z"},"0.1.0":{"name":"array-move","version":"0.1.0","description":"Move an array item to a different position","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/array-move"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["array","arr","move","change","position","index"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"e42d29f1e7f24374c40517ae960cc75d5d98c34d","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"homepage":"https://github.com/sindresorhus/array-move","_id":"array-move@0.1.0","_shasum":"8871ff26bcd3284b0e00739e0158390d6c18f9f9","_from":".","_npmVersion":"2.13.3","_nodeVersion":"3.0.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"8871ff26bcd3284b0e00739e0158390d6c18f9f9","size":1630,"noattachment":false,"key":"/array-move/-/array-move-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/array-move/download/array-move-0.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1441385447753,"_hasShrinkwrap":false,"_cnpm_publish_time":1441385447753,"_cnpmcore_publish_time":"2021-12-16T10:06:36.901Z"}},"readme":"# array-move\n\n> Move an array item to a different position\n\n## Install\n\n```\n$ npm install array-move\n```\n\n## Usage\n\n```js\nimport {arrayMoveImmutable} from 'array-move';\n\nconst input = ['a', 'b', 'c'];\n\nconst array1 = arrayMoveImmutable(input, 1, 2);\nconsole.log(array1);\n//=> ['a', 'c', 'b']\n\nconst array2 = arrayMoveImmutable(input, -1, 0);\nconsole.log(array2);\n//=> ['c', 'a', 'b']\n\nconst array3 = arrayMoveImmutable(input, -2, -3);\nconsole.log(array3);\n//=> ['b', 'a', 'c']\n```\n\n## API\n\n### arrayMoveImmutable(array, fromIndex, toIndex)\n\nClones the given `array`, moves the item to a new position in the new array, and then returns the new array. The given `array` is not mutated.\n\n### arrayMoveMutable(array, fromIndex, toIndex)\n\nMoves the item to the new position in the `array` array. Useful for huge arrays where absolute performance is needed.\n\n#### array\n\nType: `Array`\n\n#### fromIndex\n\nType: `number`\n\nThe index of item to move.\n\nIf negative, it will begin that many elements from the end.\n\n#### toIndex\n\nType: `number`\n\nThe index of where to move the item.\n\nIf negative, it will begin that many elements from the end.\n","_attachments":{},"homepage":"https://github.com/sindresorhus/array-move#readme","bugs":{"url":"https://github.com/sindresorhus/array-move/issues"},"license":"MIT"}