{"name":"ltgt","description":"implement correct ranges for level-*","version":"2.2.0","homepage":"https://github.com/dominictarr/ltgt","repository":{"type":"git","url":"git://github.com/dominictarr/ltgt.git"},"dependencies":{},"devDependencies":{"tape":"~2.13.1"},"scripts":{"prepublish":"npm ls && node test.js","test":"node test.js"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","testling":{"files":"test.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..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"]},"gitHead":"b7888f5457258f5ed7640c66ee6efa2024ffc926","bugs":{"url":"https://github.com/dominictarr/ltgt/issues"},"_id":"ltgt@2.2.0","_shasum":"b65ba5fcb349a29924c8e333f7c6a5562f2e4842","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"dist":{"shasum":"b65ba5fcb349a29924c8e333f7c6a5562f2e4842","tarball":"http://registry-npm.ywwl.com/ltgt/download/ltgt-2.2.0.tgz","integrity":"sha512-mc8flyEbqYZSpAtlwugA37o9GXchaS/1yIaW/PBoSg19DHdTevZfBowaUMTMcUwizWluCDvBaPpAI7LjRXnioQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+xekSf56I3EgMLyThPTPVrYRIRnxiQDqGy3b+vLLdqgIhAJpyhD1WCoZ8ZAwSftGLj+brIS4As0mCET4mcZ92m+LV"}],"size":5101,"noattachment":false,"key":"/ltgt/-/ltgt-2.2.0.tgz"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ltgt-2.2.0.tgz_1495038250733_0.29555000038817525"},"directories":{},"readme":"# ltgt\n\nimplement correct ranges for level-*\n\n[![build status](https://secure.travis-ci.org/dominictarr/ltgt.png)](http://travis-ci.org/dominictarr/ltgt)\n[![testling badge](https://ci.testling.com/dominictarr/ltgt.png)](https://ci.testling.com/dominictarr/ltgt)\n\n# example\n\n\n``` js\nvar ltgt = require('ltgt')\n\nltgt.start(range) //the start of the range\nltgt.end(range)   //the end of the range\n\n//returns the lower/upper bound, whether it's inclusive or not.\nltgt.lowerBound(range)\nltgt.upperBound(range)\n\nltgt.lt(range)\nltgt.gt(range)\nltgt.lte(range)\nltgt.gte(range)\n\n//return wether this is a reversed order\n//(this is significant for start/end ranges\nltgt.reverse(range)\nvar filter = ltgt.filter(range)\n\nfilter(key) == true //if key contained in range.\n\nltgt.contains(range, key)\n\n```\n\n# ways to specify ranges\n\nthere have been a variety of ways to specify ranges in level-*.\nthis module supports them all.\n\n# gt/gte, lt/lte\n\nspecify a range between a lower bound (gt, gte) and an upper bound (lt, lte)\n\nif `gte` and `gt` is undefined, read from the start of the database,\nif `lte` and `lt` is undefined, read until the end of the database,\n\n\n# min, max\n\nlegacy level-sublevel style,\nsynonym for `gte`, `lte`.\n\n# start, end, reverse\n\nlegacy levelup style.\n\nThe range is from `start` -> `end`, `start` does not specify the lowest\nrecord, instead it specifies the first record to be read. However,\n`reverse` must also be passed correctly. This is way to specify a range is\nconfusing if you need to read in reverse,\nso it's strongly recommended to use `gt/gte,lt/lte`.\n\nIf `reverse` is `true`,\n`start` *must* be `undefined` or less than `end`,\nunless `end` is `undefined`.\n\nif `reverse` is `false`\n`end` *must* be `undefined` or greater than `start`,\nunless `start` is `undefined`.\n\nif start is undefined, read from the first record in the database\nif end is undefined read until the last record in the database.\n\n# api\n\n## ltgt.contains(range, key, compare)\n\nusing the provided compare method, return `true` if `key`\nis within `range`. compare defaults to `ltgt.compare`\n\n## ltgt.filter(range, compare)\n\nreturn a function that returns true if it's argument is within range.\ncan be passed to `Array.filter`\n\n``` js\n[1,2,3,4,5].filter(ltgt.filter({gt: 2, lte: 4})\n// => [3, 4]\n```\n\n## ltgt.lowerBound(range)\n\nreturn the lower bound of `range`.\nIncase the lower bound is specified with `gt`,\ncheck `ltgt.lowerBoundExclusive`\n\n## ltgt.upperBound(range)\n\nreturn the upperBound of `range`.\nIncase the upper bound is specified with `gt`,\ncheck `ltgt.upperBoundExclusive`\n\n## ltgt.lowerBoundExclusive(range)\n\nreturn true if upper bound is exclusive.\n\n## ltgt.upperBoundExclusive(range)\n\nreturn true if lower bound is exclusive.\n\n## ltgt.start(range, default)\n\nThe start of the range. This takes into account direction (reverse)\nIf a `start` is not provided, `default` is used.\n\n## ltgt.end(range, default)\n\nThe end of the range. This takes into account direction (reverse)\nIf a `end` is not provided, `default` is used.\n\n## ltgt.startInclusive(range)\n\nreturns true if the range should start at the exact value returned\nby `start(range)` otherwise, it should skip one input.\n\n## ltgt.endInclusive(range)\n\nreturns true if the range should include the exact value returned\nby `end(range)` otherwise, it should end on that value.\n\n## ltgt.toLtgt(range, _range, map, lowerBound, upperBound)\n\nconvert a range to a new ltgt range. `_range`\nis the object to return - if you want to mutate `range`\ncall `ltgt.toLtgt(range, range, map)`\n\n`map` gets called on each key in the range, and wether it's an upper or lower bound -\nso can be used as an encode function.\n\n`map(value, isUpperBound)` if `isUpperBound` is false, this is the lower bound.\n\n## License\n\nMIT\n\n\n\n\n","publish_time":1495038250983,"_cnpm_publish_time":1495038250983,"dist-tags":{"latest":"2.2.1"}}