{"_id":"sorted-array-functions","_rev":"436177","name":"sorted-array-functions","description":"Maintain and search through a sorted array using some low level functions","dist-tags":{"latest":"1.3.0"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-08-05T06:12:39.000Z","created":"2016-10-23T09:01:07.033Z","1.3.0":"2020-08-24T09:31:26.970Z","1.2.0":"2018-06-02T14:25:44.657Z","1.1.0":"2017-12-28T15:01:11.036Z","1.0.0":"2016-10-23T09:01:07.033Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/sorted-array-functions.git"},"versions":{"1.3.0":{"name":"sorted-array-functions","version":"1.3.0","description":"Maintain and search through a sorted array using some low level functions","main":"index.js","dependencies":{},"devDependencies":{"standard":"^8.4.0","tape":"^4.6.2"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/sorted-array-functions.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/sorted-array-functions/issues"},"homepage":"https://github.com/mafintosh/sorted-array-functions","gitHead":"82c6a4cbf5c1e667805a388d5d3ebedac0fe07c7","_id":"sorted-array-functions@1.3.0","_nodeVersion":"14.4.0","_npmVersion":"6.14.5","dist":{"shasum":"8605695563294dffb2c9796d602bd8459f7a0dd5","size":3397,"noattachment":false,"key":"/sorted-array-functions/-/sorted-array-functions-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sorted-array-functions/download/sorted-array-functions-1.3.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sorted-array-functions_1.3.0_1598261486831_0.6916830752109484"},"_hasShrinkwrap":false,"publish_time":1598261486970,"_cnpm_publish_time":1598261486970},"1.2.0":{"name":"sorted-array-functions","version":"1.2.0","description":"Maintain and search through a sorted array using some low level functions","main":"index.js","dependencies":{},"devDependencies":{"standard":"^8.4.0","tape":"^4.6.2"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/sorted-array-functions.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/sorted-array-functions/issues"},"homepage":"https://github.com/mafintosh/sorted-array-functions","gitHead":"450fcd06b8fb93a379ea736a2df781422f9b4f9f","_id":"sorted-array-functions@1.2.0","_npmVersion":"6.1.0","_nodeVersion":"10.3.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"43265b21d6e985b7df31621b1c11cc68d8efc7c3","size":3258,"noattachment":false,"key":"/sorted-array-functions/-/sorted-array-functions-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sorted-array-functions/download/sorted-array-functions-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sorted-array-functions_1.2.0_1527949544551_0.48349449992811167"},"_hasShrinkwrap":false,"publish_time":1527949544657,"_cnpm_publish_time":1527949544657},"1.1.0":{"name":"sorted-array-functions","version":"1.1.0","description":"Maintain and search through a sorted array using some low level functions","main":"index.js","dependencies":{},"devDependencies":{"standard":"^8.4.0","tape":"^4.6.2"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/sorted-array-functions.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/sorted-array-functions/issues"},"homepage":"https://github.com/mafintosh/sorted-array-functions","gitHead":"48487c6940fd1867d1a1357267a25a86a348f3eb","_id":"sorted-array-functions@1.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"78fe5808ffa1beebac2ce9a22d76039dabc599ff","size":3270,"noattachment":false,"key":"/sorted-array-functions/-/sorted-array-functions-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sorted-array-functions/download/sorted-array-functions-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sorted-array-functions-1.1.0.tgz_1514473270149_0.9288073291536421"},"directories":{},"publish_time":1514473271036,"_hasShrinkwrap":false,"_cnpm_publish_time":1514473271036},"1.0.0":{"name":"sorted-array-functions","version":"1.0.0","description":"Maintain and search through a sorted array using some low level functions","main":"index.js","dependencies":{},"devDependencies":{"standard":"^8.4.0","tape":"^4.6.2"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/sorted-array-functions.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/sorted-array-functions/issues"},"homepage":"https://github.com/mafintosh/sorted-array-functions","gitHead":"39ca88126e01bc23d98a7c11a9989db6059126e5","_id":"sorted-array-functions@1.0.0","_shasum":"c0b554d9e709affcbe56d34c1b2514197fd38279","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"c0b554d9e709affcbe56d34c1b2514197fd38279","size":3141,"noattachment":false,"key":"/sorted-array-functions/-/sorted-array-functions-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sorted-array-functions/download/sorted-array-functions-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sorted-array-functions-1.0.0.tgz_1477213265074_0.4219658076763153"},"directories":{},"publish_time":1477213267033,"_cnpm_publish_time":1477213267033,"_hasShrinkwrap":false}},"readme":"# sorted-array-functions\n\nMaintain and search through a sorted array using some low level functions\n\n```\nnpm install sorted-array-functions\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/sorted-array-functions.svg?style=flat)](http://travis-ci.org/mafintosh/sorted-array-functions)\n\n## Usage\n\n``` js\nvar sorted = require('sorted-array-functions')\nvar list = []\n\nsorted.add(list, 1)\nsorted.add(list, 4)\nsorted.add(list, 2)\n\nconsole.log(list) // prints out [1, 2, 4]\nconsole.log(sorted.has(list, 2)) // returns true\nconsole.log(sorted.has(list, 3)) // returns false\nconsole.log(sorted.eq(list, 2)) // returns 1 (the index)\nconsole.log(sorted.gt(list, 2)) // returns 2\nconsole.log(sorted.gt(list, 4)) // returns -1\n```\n\n## API\n\n#### `sorted.add(list, value, [compare])`\n\nInsert a new value into the list sorted.\nOptionally you can use a custom compare function that returns, `compare(a, b)` that returns 1 if `a > b`, 0 if `a === b` and -1 if `a < b`.\n\n#### `sorted.addFromFront(list, value, [compare])`\n\nInserts a new value (same result as `sorted.add()`) optimized for prepend.\n\n#### `var bool = sorted.remove(list, value, [compare])`\n\nRemove a value. Returns true if the value was in the list.\n\n#### `var bool = sorted.has(list, value, [compare])`\n\nCheck if a value is in the list.\n\n#### `var index = sorted.eq(list, value, [compare])`\n\nGet the index of a value in the list (uses binary search).\nIf the value could not be found -1 is returned.\n\n#### `var index = sorted.gte(list, value, [compare])`\n\nGet the index of the first value that is `>=`.\nIf the value could not be found -1 is returned.\n\n#### `var index = sorted.gt(list, value, [compare])`\n\nGet the index of the first value that is `>`.\nIf the value could not be found -1 is returned.\n\n#### `var index = sorted.lte(list, value, [compare])`\n\nGet the index of the first value that is `<=`.\nIf the value could not be found -1 is returned.\n\n#### `var index = sorted.lt(list, value, [compare])`\n\nGet the index of the first value that is `<`.\nIf the value could not be found -1 is returned.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/sorted-array-functions","bugs":{"url":"https://github.com/mafintosh/sorted-array-functions/issues"},"license":"MIT"}