{"_id":"compute-reverse","_rev":"9-b43fd31dd29dead8d0d0ec8c70dc23c3","name":"compute-reverse","description":"Reverse an array.","dist-tags":{"latest":"1.1.0"},"versions":{"0.0.0":{"name":"compute-reverse","version":"0.0.0","description":"Reverse an array in place.","author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"scripts":{"test":"mocha","test-cov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec","coveralls":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls"},"main":"./lib","repository":{"type":"git","url":"git://github.com/compute-io/reverse.git"},"keywords":["compute.io","compute","computation","reverse","array"],"bugs":{"url":"https://github.com/compute-io/reverse/issues"},"dependencies":{},"devDependencies":{"chai":"1.x.x","mocha":"1.x.x","coveralls":"^2.11.1","istanbul":"^0.3.0"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"gitHead":"801a2b31e6fda43146173c6df2cb2cf5fc48eecd","homepage":"https://github.com/compute-io/reverse","_id":"compute-reverse@0.0.0","_shasum":"ddf1da6045b774582cd73c7b22c5954708b7941a","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}],"dist":{"shasum":"ddf1da6045b774582cd73c7b22c5954708b7941a","tarball":"https://registry.npmjs.org/compute-reverse/-/compute-reverse-0.0.0.tgz","integrity":"sha512-9F9MHZQcVuTb1WrpFO+QelYIRc2zXp0PaIr18p/iuBA/dVHMoJrQjhXtDZEDFOmgWaMTxe2HNhei9ieUPR6lFQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFJmEtBW021NUuMICs0+uMN1tZathCP3Mweq7wryS+DXAiB1MdgAGaeaUFbxoiNBGdB0Ff6zPDoR7YyNQYiTIx53xg=="}]}},"1.0.0":{"name":"compute-reverse","version":"1.0.0","description":"Reverse an array in place.","author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"scripts":{"test":"mocha","test-cov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec","coveralls":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls"},"main":"./lib","repository":{"type":"git","url":"git://github.com/compute-io/reverse.git"},"keywords":["compute.io","compute","computation","reverse","array"],"bugs":{"url":"https://github.com/compute-io/reverse/issues"},"dependencies":{},"devDependencies":{"chai":"1.x.x","mocha":"1.x.x","coveralls":"^2.11.1","istanbul":"^0.3.0"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"gitHead":"6421e6f6dbb589ba5951e8a7c9d54aa11a3cfd58","homepage":"https://github.com/compute-io/reverse","_id":"compute-reverse@1.0.0","_shasum":"7c8f1915e52b559212e421c1fabc04e89cea33e8","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}],"dist":{"shasum":"7c8f1915e52b559212e421c1fabc04e89cea33e8","tarball":"https://registry.npmjs.org/compute-reverse/-/compute-reverse-1.0.0.tgz","integrity":"sha512-L+BPEa4rJnBo0gJ/soEurbwkfeTIqIBNxjmUMxZSwRAvdgd+vtkHLYsOlvOLhJCyrIwaqwf2zM2Q9ujnvXZXZg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOv9+DCtDU0ZXuGSJWZgz4Ji1N+LIy4C8kiLh9p+lzTwIgBTaHJGKLPdFHrHo7xK0ctEgrEgpD8OkDqOL43smnhZ0="}]}},"1.0.1":{"name":"compute-reverse","version":"1.0.1","description":"Reverse an array in place.","author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"scripts":{"test":"mocha","test-cov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec","coveralls":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls"},"main":"./lib","repository":{"type":"git","url":"git://github.com/compute-io/reverse.git"},"keywords":["compute.io","compute","computation","reverse","array"],"bugs":{"url":"https://github.com/compute-io/reverse/issues"},"dependencies":{},"devDependencies":{"chai":"1.x.x","mocha":"1.x.x","coveralls":"^2.11.1","istanbul":"^0.3.0"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"gitHead":"4058ef47e5966711a95492e56efd48a4b0d908f9","homepage":"https://github.com/compute-io/reverse","_id":"compute-reverse@1.0.1","_shasum":"d3a2b496a25d799886ccf2ab02aeb88747f4e0bc","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}],"dist":{"shasum":"d3a2b496a25d799886ccf2ab02aeb88747f4e0bc","tarball":"https://registry.npmjs.org/compute-reverse/-/compute-reverse-1.0.1.tgz","integrity":"sha512-qTJoX1stb5GJibuZQfDFPEPVCHGpwcJphfIJDSHLE8TfZEtIQSW6X+R7FU2iSGknGz2GC5kvGW1e1wmt+hhhOw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDOq2OjrqOabwiVyH/9QYF0JRI8Rg+QGu0CC/8C1gkF3AiEAqSgr51mIrjBhH2n3DW9H3ozEcxX47td1heqi+RNEfsQ="}]}},"1.1.0":{"name":"compute-reverse","version":"1.1.0","description":"Reverse an array.","author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"scripts":{"test":"mocha","test-cov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec","coveralls":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls"},"main":"./lib","repository":{"type":"git","url":"git://github.com/compute-io/reverse.git"},"keywords":["compute.io","compute","computation","reverse","array","matrix","utilities","utility","util","fliplr","flip","flipud","inplace"],"bugs":{"url":"https://github.com/compute-io/reverse/issues"},"dependencies":{"validate.io-array":"^1.0.3","validate.io-boolean-primitive":"^1.0.0","validate.io-object":"^1.0.3"},"devDependencies":{"chai":"2.x.x","coveralls":"^2.11.1","istanbul":"^0.3.0","jshint":"2.x.x","jshint-stylish":"^1.0.0","mocha":"2.x.x"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"gitHead":"9dc85a9b4e2e00b58c35228a0a6b3c6f6e49d6ab","homepage":"https://github.com/compute-io/reverse#readme","_id":"compute-reverse@1.1.0","_shasum":"7a15f3864cd7ced496cea76de70f6bbd8bc94dd5","_from":".","_npmVersion":"2.8.3","_nodeVersion":"0.10.29","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"dist":{"shasum":"7a15f3864cd7ced496cea76de70f6bbd8bc94dd5","tarball":"https://registry.npmjs.org/compute-reverse/-/compute-reverse-1.1.0.tgz","integrity":"sha512-Bm9/z9xO/mixiFahF4GqiRs+wT/YQhwc11mKP5nkF27yUTQzRp5y1wyDS43L1OMJkFN5K/BldIjOJepkSaAaxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHCnMfFkaZI9MHrOQ4tDxlD/EtUj1+Nv1CBqaM0umP3LAiEA5qeX6ltqZfWhwCF9iT8trRVxRfgcwOK171BfuxQpRlE="}]},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}]}},"readme":"Reverse\n===\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]\n\n> Reverse an array.\n\n\n## Installation\n\n``` bash\n$ npm install compute-reverse\n```\n\nFor use in the browser, use [browserify](https://github.com/substack/node-browserify).\n\n\n## Usage\n\n``` javascript\nvar reverse = require( 'compute-reverse' );\n```\n\n#### reverse( arr[, options] )\n\nReverses an `array`.\n\n``` javascript\nvar arr = [ 1, 2, 3, 4 ];\n\nvar out = reverse( arr );\n// returns [ 4, 3, 2, 1 ]\n```\n\nBy default, the input `array` is __mutated__. To return a new `array`, set the `copy` option to `true`.\n\n``` javascript\nvar arr = [ 1, 2, 3, 4 ];\n\nvar out = reverse( arr, {\n\t'copy': true\n});\n// returns [ 4, 3, 2, 1 ];\n\nconsole.log( arr === out );\n// returns false\n```\n\n\n\n## Examples\n\n``` javascript\nvar reverse = require( 'compute-reverse' );\n\nvar arr = new Array( 100 );\nfor ( var i = 0; i < arr.length; i++ ) {\n\tarr[ i ] = i;\n}\nreverse( arr );\n\nconsole.log( JSON.stringify( arr ) );\n```\n\nTo run the example code from the top-level application directory,\n\n``` bash\n$ node ./examples/index.js\n```\n\n\n## Notes\n\nAccording to [ECMA specification 262](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.8), when implementing the native `array.reverse()` method, one must check whether `array` elements are defined before determining how to swap elements. If one element is a `hole`, only the non-hole value is assigned to a temporary value before being assigned to a new position in the `array`. The element's original position is then deleted. See the V8 (Node.js) [implementation](https://github.com/joyent/node/blob/master/deps/v8/src/array.js) for an example.\n\nIf we eliminate the `hole` checks and additional temporary variables, we can streamline the algorithm for performance gains. See [jsPerf](http://jsperf.com/array-reverse-native-vs-loop/3) for benchmarks.\n\n\n## Tests\n\n### Unit\n\nUnit tests use the [Mocha](http://mochajs.org) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:\n\n``` bash\n$ make test\n```\n\nAll new feature development should have corresponding unit tests to validate correct functionality.\n\n\n### Test Coverage\n\nThis repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-cov\n```\n\nIstanbul creates a `./reports/coverage` directory. To access an HTML version of the report,\n\n``` bash\n$ make view-cov\n```\n\n\n---\n## License\n\n[MIT license](http://opensource.org/licenses/MIT). \n\n\n## Copyright\n\nCopyright &copy; 2014-2015. Athan Reines.\n\n\n[npm-image]: http://img.shields.io/npm/v/compute-reverse.svg\n[npm-url]: https://npmjs.org/package/compute-reverse\n\n[travis-image]: http://img.shields.io/travis/compute-io/reverse/master.svg\n[travis-url]: https://travis-ci.org/compute-io/reverse\n\n[coveralls-image]: https://img.shields.io/coveralls/compute-io/reverse/master.svg\n[coveralls-url]: https://coveralls.io/r/compute-io/reverse?branch=master\n\n[dependencies-image]: http://img.shields.io/david/compute-io/reverse.svg\n[dependencies-url]: https://david-dm.org/compute-io/reverse\n\n[dev-dependencies-image]: http://img.shields.io/david/dev/compute-io/reverse.svg\n[dev-dependencies-url]: https://david-dm.org/dev/compute-io/reverse\n\n[github-issues-image]: http://img.shields.io/github/issues/compute-io/reverse.svg\n[github-issues-url]: https://github.com/compute-io/reverse/issues\n","maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}],"time":{"modified":"2022-06-13T20:32:02.790Z","created":"2014-10-03T06:41:10.771Z","0.0.0":"2014-10-03T06:41:10.771Z","1.0.0":"2014-10-03T06:41:32.917Z","1.0.1":"2014-10-03T06:53:58.659Z","1.1.0":"2015-05-06T02:33:47.012Z"},"homepage":"https://github.com/compute-io/reverse#readme","keywords":["compute.io","compute","computation","reverse","array","matrix","utilities","utility","util","fliplr","flip","flipud","inplace"],"repository":{"type":"git","url":"git://github.com/compute-io/reverse.git"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"bugs":{"url":"https://github.com/compute-io/reverse/issues"},"readmeFilename":"README.md"}