{"_id":"sorted","_rev":"12-266a5f1ac9f9f548b29e4300a896e287","name":"sorted","description":"sorted arrays","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.0":{"name":"sorted","version":"0.0.0","description":"sorted arrays","main":"index.js","directories":{"lib":".","test":"test"},"dependencies":{},"devDependencies":{"expresso":"0.7.x"},"scripts":{"test":"expresso"},"repository":{"type":"git","url":"git://github.com/substack/node-sorted.git"},"keywords":["sort","array","in-place","order"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT/X11","engine":{"node":">=0.4"},"_id":"sorted@0.0.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.10","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"68687afffc1d2d639af2d3c4f7d871e3de87856c","tarball":"https://registry.npmjs.org/sorted/-/sorted-0.0.0.tgz","integrity":"sha512-S6FL5PBhqSvwyeA+4qCgQUDBs7VrBPPGuQOM5LhwgFNREFYu9oFQkSD26OslAFQ3Q4X/GAcAEU7V3TlwNInjXw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBauxsvuBpu6cuEuy1vLpnlPKqimlJ9akyU69S/LEXkQAiA87GRnlRGbfArqx4/T3bdxzdfQ/q5zNad/BVJPTTcx1A=="}]},"maintainers":[{"name":"substack","email":"mail@substack.net"}]},"0.1.0":{"name":"sorted","version":"0.1.0","description":"sorted arrays","main":"index.js","devDependencies":{"tape":"~2.12.1"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"http://github.com/substack/node-sorted.git"},"keywords":["sort","array","in-place","order"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/15","firefox/latest","firefox/nightly","chrome/15","chrome/latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"bugs":{"url":"https://github.com/substack/node-sorted/issues"},"homepage":"https://github.com/substack/node-sorted","_id":"sorted@0.1.0","dist":{"shasum":"1951fea9f831b1f674b6e87c5d26bc6ea85d176c","tarball":"https://registry.npmjs.org/sorted/-/sorted-0.1.0.tgz","integrity":"sha512-GOR8r2RGIx5WuKvNuzc/KlqbQtepDekpC0RLnw1pckBEphee2zCpzMlyq5NaUposoTof2YhUw3WhyduJLAOmBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEQlN9pOmTdZC4OlT0e0UZXXQOLdLnBMXZqnPz1PuhrkAiEAjOa/LIsflmKXpy/8GLFKv+lS7LieGSeGiu2XdQWmavw="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{}},"0.1.1":{"name":"sorted","version":"0.1.1","description":"sorted arrays","main":"index.js","devDependencies":{"tape":"~2.12.1"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"http://github.com/substack/node-sorted.git"},"keywords":["sort","array","in-place","order"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/15","firefox/latest","firefox/nightly","chrome/15","chrome/latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"bugs":{"url":"https://github.com/substack/node-sorted/issues"},"homepage":"https://github.com/substack/node-sorted","_id":"sorted@0.1.1","dist":{"shasum":"915fd9c97e976be4c11157d5a0de48f33fcd3532","tarball":"https://registry.npmjs.org/sorted/-/sorted-0.1.1.tgz","integrity":"sha512-2Vd2u6EjwnkPOBdL2bKeYmFAP5Kd504R7JlfqeoSmxdOEA5D2ANrtQN3sdhbug9S1bcNkipjxBg0yyZcaZuuhQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHEZ36MIMp5LztAedhQf34oegdQb9LyJWD3UTnDGHFr+AiBwtdp16uSpSDA2PSRrUNHll2w1ak7X4tiB2/3O/Yuf7g=="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"directories":{}}},"maintainers":[{"email":"nopersonsmodules@gmail.com","name":"nopersonsmodules"}],"time":{"modified":"2022-11-08T10:40:59.404Z","created":"2011-08-10T09:35:09.462Z","0.0.0":"2011-08-10T09:35:10.488Z","0.1.0":"2014-04-03T19:42:49.240Z","0.1.1":"2014-04-03T19:46:44.608Z"},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"repository":{"type":"git","url":"http://github.com/substack/node-sorted.git"},"readme":"# sorted\n\nA sorted array data structure\n\n[![testling badge](https://ci.testling.com/substack/node-sorted.png)](https://ci.testling.com/substack/node-sorted)\n\n[![build status](https://secure.travis-ci.org/substack/node-sorted.png)](http://travis-ci.org/substack/node-sorted)\n\n# example\n\n## sorted\n\n```\nvar sorted = require('sorted');\nvar xs = sorted([ 3, 1, 2, 0 ]);\nconsole.log(xs);\nxs.push(2.5);\nconsole.log(xs);\n```\n\noutput:\n\n```\n<Sorted [0,1,2,3]>\n<Sorted [0,1,2,2.5,3]>\n```\n\n\n## neighbors\n\n``` js\nvar sorted = require('sorted');\n\nvar xs = 'bhdajemfcngiklop'.split('');\nvar s = sorted(xs);\nvar ix = s.findIndex('h');\nconsole.log('current:', s.get(ix));\nconsole.log('prev:', s.get(ix-1));\nconsole.log('next:', s.get(ix+1));\n```\n\noutput:\n\n```\ncurrent: h\nprev: g\nnext: i\n```\n\n## range\n\n``` js\nvar sorted = require('sorted');\n\nvar xs = 'bhdajemfcngiklop'.split('');\nvar s = sorted(xs);\nconsole.log(s.range('e', 'j').join(''));\n```\n\noutput:\n\n```\nefghij\n```\n\n# methods\n\n``` js\nvar sorted = require('sorted');\n```\n\n## var s = sorted(xs, cmp)\n\nCreate a new sorted array `s` given an array `xs` which may or may not be sorted\nand a comparison function `cmp`. If cmp isn't specified it defaults to:\n\n``` js\nfunction cmp (a, b) {\n    if (a == b) return 0\n    else if (a > b) return 1\n    else if (a < b) return -1\n    else throw new RangeError('Unstable comparison: ' + a + ' cmp ' + b)\n}\n```\n\n`cmp` should return `0` for equality, `< 0` for less than, and `> 0` for greater\nthan. If `cmp` returns a value for which comparisons fail such as `NaN` it will throw\na RangeError.\n\n## s.isSorted(xs, cmp)\n\nReturn whether `xs` is sorted using `cmp`.\n`xs` can be an array or a sorted instance, which always return true.\n\n## s.fromSorted(xs, cmp)\n\nCreate a new sorted structure from a pre-sorted array or sorted object `xs`\nusing a comparison `cmp` which falls back to the default if unspecified.\n\n## s.push(x, ...), s.unshift(x, ...)\n\nInsert the element or elements `x, ...` into the data structure, maintaining the\nsorted order.\n\n## s.splice(i, len, ...)\n\nRemove `len` elements starting at index `i`.\nAny additional arguments will be pushed to the structure maintaining the sorted\norder.\n\n## s.findIndex(x, start=0, end=s.length)\n\nSearch for the index of the value `x` starting at index `start` and ending at\n`end` using a binary search.\n\nIf the value lies outside the given range, return either bound depending.\n\n## s.toArray()\n\nReturn a copy of the underlying sorted data as an array.\n\n## s.sort(cmp)\n\nReturn a new sorted structure using the comparison `cmp`. If the comparison is\nthe same as `s.compare`, returns a sorted copy.\n\n## s.concat(x, ...)\n\nReturn a new sorted which concatenates the items, arrays, and sorteds in the\narguments list.\n\n## s.insert(xs)\n\nInsert the array, element, or sorted `xs` into the structure. If `xs` is a\nsorted, this fact will be observed to make the insertion go faster.\n\n## s.get(i)\n\nGet the element at index `i`.\n\n## s.set(i, x)\n\nSet the element at index `i`, preserving the ordering.\n\n## s.slice(i, j)\n\nReturn a new sorted containing elements between `i` and `j` using `s.compare`.\n\n## s.map(fn)\n\nReturn a new sorted mapping over the elements of `s` with `fn`.\n\n## s.filter(fn)\n\nReturn a new sorted filtering over the elements of `s` with `fn`.\n\n## s.shift()\n\nReturn and remove the least item in the structure.\n\n## s.pop()\n\nReturn and remove the greatest item in the structure.\n\n## s.range(a, b)\n\nReturn the range of all elements from `a` through `b`, inclusive.\n\n# attributes\n\n## s.length\n\nNumber of elements in the structure\n\n## s.compare\n\nComparison function being used\n\n## s.elements\n\nThe raw elements. If you mess with these directly you risk invalidating the\nordering.\n\n# array methods\n\nThese methods work exactly like in a regular array:\n\n* indexOf\n* forEach\n* reduce\n* reduceRight\n* every\n* some\n* join\n","homepage":"https://github.com/substack/node-sorted","keywords":["sort","array","in-place","order"],"bugs":{"url":"https://github.com/substack/node-sorted/issues"},"license":"MIT","readmeFilename":"readme.markdown","users":{"mmocny":true}}