{"name":"quickselect","version":"3.0.0","type":"module","description":"A tiny and fast selection algorithm in JavaScript.","repository":{"type":"git","url":"git+https://github.com/mourner/quickselect.git"},"module":"index.js","main":"index.js","exports":"./index.js","devDependencies":{"eslint":"^9.6.0","eslint-config-mourner":"^4.0.1","esm":"^3.2.25","rollup":"^4.18.0","tape":"^5.8.1","typescript":"^5.5.3"},"scripts":{"pretest":"eslint *.js && tsc","test":"node test.js","bench":"node bench.js"},"types":"index.d.ts","keywords":["selection","algorithm","quickselect","sort","partial","floyd","rivest"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","_id":"quickselect@3.0.0","gitHead":"c26429fd0a6f7b63b48a269e04748c34e8c0c5f4","bugs":{"url":"https://github.com/mourner/quickselect/issues"},"homepage":"https://github.com/mourner/quickselect#readme","_nodeVersion":"20.14.0","_npmVersion":"10.8.0","dist":{"integrity":"sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==","shasum":"a37fc953867d56f095a20ac71c6d27063d2de603","tarball":"http://registry-npm.ywwl.com/quickselect/download/quickselect-3.0.0.tgz","fileCount":5,"unpackedSize":5287,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEgnUbmQ2y0wDBLjBIhDnj2+73IFd97P6jqCH0w7bzbLAiEA/IGfB9a+buckUxr151OhH1ClJ4aqaLbNpf5ovvnn13k="}],"size":2206,"noattachment":false,"key":"/quickselect/-/quickselect-3.0.0.tgz"},"_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickselect_3.0.0_1719998312530_0.8824770315142825"},"_hasShrinkwrap":false,"readme":"## quickselect\n\nA tiny and fast [selection algorithm](https://en.wikipedia.org/wiki/Selection_algorithm) in JavaScript\n(specifically, [Floyd-Rivest selection](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm)).\n\n```js\nquickselect(array, k[, left, right, compareFn]);\n```\n\nRearranges items so that all items in the `[left, k]` are the smallest.\nThe `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`.\n\n- `array`: the array to partially sort (in place)\n- `k`: middle index for partial sorting (as defined above)\n- `left`: left index of the range to sort (`0` by default)\n- `right`: right index (last index of the array by default)\n- `compareFn`: compare function\n\nExample:\n\n```js\nconst arr = [65, 28, 59, 33, 21, 56, 22, 95, 50, 12, 90, 53, 28, 77, 39];\n\nquickselect(arr, 8);\n\n// arr is [39, 28, 28, 33, 21, 12, 22, 50, 53, 56, 59, 65, 90, 77, 95]\n//                                         ^^ middle index\n```\n","publish_time":1719998312790,"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"_cnpm_publish_time":1719998312790,"dist-tags":{"latest":"3.0.0"}}