{"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":{"integrity":"sha512-+RY54S8OuVvg94THpneQvFRmqWdAHeqtMzgMW6JNurHxe8rsS07cHQdfGkXnTUXiBcyZ0j3SiDIxxj0RPiqCkQ==","shasum":"2c3730f056cc926f62a59769a5a8cda2fb6d8c55","tarball":"http://registry-npm.ywwl.com/array-move/download/array-move-4.0.0.tgz","fileCount":5,"unpackedSize":5064,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhEvTmCRA9TVsSAnZWagAA4hMP/2NQpUzBwSrD9pFuq3/v\nwKhp5Psqpjs5wZXmYO9/FYjOA5O2r2rzkc6TfAsQVzoNmyZlrh4496Dj8uP3\nJVz6hZRCzLexuXbQCWluoy0pDDe+6JRwjSzQcYgM+lmiaToZSWmppXFKD12L\nVrt3Dpz4gzdc1Kns7IYMBK3ot9rsub01eJkUYuJyVKrx3E+vROIIe/qrLKVa\n1bTUvfOcL+jINSDkezIRCq1ETG7aS7Eu7Cyjjz8+TnSmo1vj2eP8Y1iIu1Q3\nli2jb6wJlNmeELLe11deyqlSYrItG6RNElnFrauP26lzSbyNGCaLcECvgR7B\nXz4zLc+vo+BVryQ3JOSgkj4tMc1L+M1wVeg92uh5U4Nu9VPON25XFJOiwiPp\n65lqlxTm/JNJbm4vNxlqegm2lFSD6gBdzU3F66zWK6areTEFF9HPbl4fBtwS\nTUd3xzGGPinveYuCT7Qi0mIkgC/8yz36xGQ3C3KHHZZKYZpc7fP7pbjS6h3J\n/dw2yVIYTJCQ/FBdHv1mLS9I/z7yZJ15b5stQcdqf3lbv8dD5FACBE4q5ObA\n8n1Xtuv+krbszpo2AYscvMbymBsQWtBKZDub2UDbccJ7U8rB0DKQigEcM2rg\nFAGWGhZfj8hjPWLXAnYSCmnRtilVwDBBW7U0QxUdhGz7n3rgadt8875/2Fz0\nZpyd\r\n=kFsa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICVBfMEcGAR4LvyhrW+AFi9GjzKAk3bntvjvDGyLfebOAiA1UZD+lnn1LlYbdix13NdjhH7lgxbsG3H8zNKjp6A7Ng=="}],"size":1938,"noattachment":false,"key":"/array-move/-/array-move-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-move_4.0.0_1628632293986_0.6382584618365867"},"_hasShrinkwrap":false,"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","publish_time":1628632294127,"_cnpm_publish_time":1628632294127,"dist-tags":{"latest":"4.0.0"}}