{"_id":"to-rotated","_rev":"4103604","name":"to-rotated","description":"Rotate an array by a given number of steps","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-01-11T18:46:58.000Z","created":"2024-05-22T17:31:26.733Z","1.0.0":"2024-05-22T17:31:26.733Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/to-rotated.git"},"versions":{"1.0.0":{"name":"to-rotated","version":"1.0.0","description":"Rotate an array by a given number of steps","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/to-rotated.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava"},"keywords":["array","rotate","rotation","rotated","shift","immutable","steps","cycle","cycling","cycled","move"],"devDependencies":{"ava":"^6.1.3","xo":"^0.58.0"},"_id":"to-rotated@1.0.0","gitHead":"60f6e0002b0a2d649bb2e24002c54bb48ac118ce","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/to-rotated/issues"},"homepage":"https://github.com/sindresorhus/to-rotated#readme","_nodeVersion":"18.20.2","_npmVersion":"10.6.0","dist":{"shasum":"cdf13ece5203e72384a79020508ae1dc80d3b48f","size":1836,"noattachment":false,"key":"/to-rotated/-/to-rotated-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-rotated/download/to-rotated-1.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/to-rotated_1.0.0_1716399086575_0.41139350361903393"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-05-22T17:31:26.733Z","publish_time":1716399086733,"_source_registry_name":"default","_cnpm_publish_time":1716399086733}},"readme":"# to-rotated\n\n> Rotate an array by a given number of steps\n\nArray rotation shifts the elements left or right by a certain number of steps. Elements that move past the end reappear at the beginning. For example, rotating `[1, 2, 3, 4, 5]` by 2 steps to the right results in `[4, 5, 1, 2, 3]`.\n\n## Install\n\n```sh\nnpm install to-rotated\n```\n\n## Usage\n\n```js\nimport toRotated from 'to-rotated';\n\nconsole.log(toRotated([1, 2, 3, 4, 5], 2));\n//=> [4, 5, 1, 2, 3]\n\nconsole.log(toRotated([1, 2, 3, 4, 5], -2));\n//=> [3, 4, 5, 1, 2]\n```\n\n## API\n\n### toRotated(array, steps)\n\nReturns a new array that is rotated by the given number of steps.\n","_attachments":{},"homepage":"https://github.com/sindresorhus/to-rotated#readme","bugs":{"url":"https://github.com/sindresorhus/to-rotated/issues"},"license":"MIT"}