{"_id":"reachdown","_rev":"2-c0ddfbea99da2b672e34abbc592ec5f7","name":"reachdown","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"reachdown","version":"1.0.0","description":"Get the inner db of an (abstract-)level(up|down) onion","license":"MIT","author":{"name":"Vincent Weevers"},"scripts":{"test":"standard && node test.js"},"dependencies":{},"devDependencies":{"level-mem":"^5.0.0","standard":"^14.1.0","subleveldown":"^4.1.1","tape":"^4.11.0"},"keywords":["abstract-leveldown","level","levelup"],"engines":{"node":">=6"},"repository":{"type":"git","url":"git+https://github.com/vweevers/reachdown.git"},"bugs":{"url":"https://github.com/vweevers/reachdown/issues"},"homepage":"https://github.com/vweevers/reachdown","gitHead":"dea6326d6d8e1771e3cd25257d481654253094f5","_id":"reachdown@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.14.1","_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"dist":{"integrity":"sha512-Ty7X/t52GwgRam3SMpZC2grmutuUarkiD4sVhjM8g8/5NlX8PAEsYO/pyx6nTTqS9udee1j1BxaAS/f6Rm8SMw==","shasum":"c63715190c9a0dd108bea3610bf9690ad0983edb","tarball":"https://registry.npmjs.org/reachdown/-/reachdown-1.0.0.tgz","fileCount":4,"unpackedSize":5717,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdc+hkCRA9TVsSAnZWagAAt/oP/i8R8BRg/a6Wqo1p16se\n9LpVX1wKOxlxk5YrpLlkRWtE9rAbcNENttxK4IJNn7DqcAjxY8T6oCq0Q1fm\nBrD1jzdBxMepk+7Sb4IQlM5mNedytxq4BANmHYxIpJWDy4oRUNysePtQlfT4\ni2Vxt9mcAdHxj1RxoPvhwkWDT9GyRQhkK1fmRK/p/bV3Wd8MajqtLzsbG4al\nYNxmhPF0HyKuxcwnaPGIOXkSgfUUG+9F+VUVlFoplyiZZPYpYaCG1wbO5JW7\neTCkdEgYZFIHlKCOgU/IBNBd8+boTug1YNS1Z6Jbavbb63zu8pyCUGZIx2LX\nJuQnr8tQUY2ON+5KpA5ZUAGGBKbDV5XAqEvFuspE9xFpykg7iFCqot4o2jFW\n6pISpDqbrwfyAhkkWAothGKlw7pmo4lbBvtngd6jkxR5H6GYd3CgMREc6aFH\naAP3oiiLJKkCU23/qJJnzYutyhwKjz+MdAHkIzx3iibEJV0G9++YKdLkBItb\nWY53uX6Tq8ia36ciPc3oqUG0CVPuqWdlQWTjLrCff1jciac8Kb2BC3DoepwT\nKqyE5fnNZ0/2EqB1tdMc2EKIuGAY60AksLJyXS82GEbcvjmhH5tU5sEWsgH6\nMrdCI6s9QhQJT3FyGx/AJb0MdOQkAyCpRM14GMKZNzqfVwTultz1s+eGcrn4\nMrtY\r\n=atK5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD25a16A4ks2/b1AZm5gG+Z5R8Edr793+dhxL6yvueEyQIgUpGr7siLuOpzebrVfdTmdyFYsn0Eo5FwTeJUqmjblaI="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/reachdown_1.0.0_1567877220172_0.7486319189561244"},"_hasShrinkwrap":false},"1.1.0":{"name":"reachdown","version":"1.1.0","description":"Get the inner db of an (abstract-)level(up|down) onion","license":"MIT","author":{"name":"Vincent Weevers"},"scripts":{"test":"standard && hallmark && node test.js","hallmark":"hallmark --fix"},"dependencies":{},"devDependencies":{"hallmark":"^2.0.0","level-mem":"^5.0.0","standard":"^14.1.0","subleveldown":"^4.1.1","tape":"^4.11.0"},"keywords":["abstract-leveldown","level","levelup"],"engines":{"node":">=6"},"repository":{"type":"git","url":"git+https://github.com/vweevers/reachdown.git"},"bugs":{"url":"https://github.com/vweevers/reachdown/issues"},"homepage":"https://github.com/vweevers/reachdown","gitHead":"afe49b643d559ffa017101db5b8d73c0a1666a87","_id":"reachdown@1.1.0","_nodeVersion":"12.11.1","_npmVersion":"6.11.3","_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"dist":{"integrity":"sha512-6LsdRe4cZyOjw4NnvbhUd/rGG7WQ9HMopPr+kyL018Uci4kijtxcGR5kVb5Ln13k4PEE+fEFQbjfOvNw7cnXmA==","shasum":"c3b85b459dbd0fe2c79782233a0a38e66a9b5454","tarball":"https://registry.npmjs.org/reachdown/-/reachdown-1.1.0.tgz","fileCount":4,"unpackedSize":6293,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeiFgUCRA9TVsSAnZWagAAYfwP/28rULaLQjN4PYl5dZgG\nrQvBEN2bw/pcIyO2d7dnWUYvkYrMsR23K8ZHSXcbdDXoK9diLgK6Gn6g8sgj\nFIe+cNpi/FKAFZs0+1FWCyk+/iZ4sA38wyb4yfRzoIxAJJ+omJh7isaKdmic\nP4M1bwY5eBFO1ywsk/IH3ZOQhUo0P0Bo39BtRf4dHMYdnZCysB0x4ouImpFq\nVTaXnKA6kpvhPH7giVvNFvs4cqJt8vC/vQSBLwOSqJokAUUuccsrtS29lNwR\nTWj83jCwqRHOXqKBDIiZbUWot0jAyo0jUSCADjZKbR4KcOwLGs4q/QErsmWQ\nnvQ6RhguDATcVkjzGvFHM9oL1MjfQ2M9HsS4tqt8ehL6Gp+b+wtZeXHjm544\niUUVm3AIOXcTI8CQR4sNgg6YyOqaeMSuQj9YpVKo9ejcUhldR+m1KF8lvlVi\nDFbrq6Hr34APyLVnIhgPUf/1UFT649hGiQ49ncfmpi0mGIvLwBTdBy/+nTTp\ns89V9m/QZVjv3H7uyazEssMbyH7eZJuZxpcLZZnKcsSwynIgtfarmuhPi2SL\nJ70wA/hJCk1BYmFbAMMG0qGQA7ZuUvlLVAh492UQo9SOAZ+2ByNvLwq+vrXp\nl2JwmKPWAZDi0U96lFvwQgj5wZ7G1wI3vdDTdPsiZTQ2xLDB50T/oxtwtS/b\nBMjs\r\n=lA8T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEg+HxwYLoEhh3P4RbnYQQfSSoKI/5ehSnzw8oupYelmAiAC6SaDfu5Tal+78UOsLOdq32NMQrfCS3FS0smnbY/IWA=="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/reachdown_1.1.0_1585993747533_0.00850081541964709"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-07T17:27:00.171Z","1.0.0":"2019-09-07T17:27:00.318Z","modified":"2022-05-14T05:37:38.686Z","1.1.0":"2020-04-04T09:49:07.661Z"},"maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"description":"Get the inner db of an (abstract-)level(up|down) onion","homepage":"https://github.com/vweevers/reachdown","keywords":["abstract-leveldown","level","levelup"],"repository":{"type":"git","url":"git+https://github.com/vweevers/reachdown.git"},"author":{"name":"Vincent Weevers"},"bugs":{"url":"https://github.com/vweevers/reachdown/issues"},"license":"MIT","readme":"# reachdown\n\n> **Get the inner db of an `(abstract-)level(up|down)` onion.** \n> Useful for modules like `subleveldown` to peel off redundant layers.\n\n[![npm status](http://img.shields.io/npm/v/reachdown.svg)](https://www.npmjs.org/package/reachdown)\n[![node](https://img.shields.io/node/v/reachdown.svg)](https://www.npmjs.org/package/reachdown)\n[![Travis build status](https://img.shields.io/travis/vweevers/reachdown.svg?label=travis)](http://travis-ci.org/vweevers/reachdown)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Example\n\n```js\nconst reachdown = require('reachdown')\nconst db = require('level')('example')\n```\n\nGet the innermost `db`, which in this case is a `leveldown` instance in node or `level-js` in browsers:\n\n```js\nconst down = reachdown(db)\n```\n\nGet a specific layer by [type](#supported-types):\n\n```js\nconst enc = reachdown(db, 'encoding-down')\nconst down = reachdown(enc)\nconst levelup = reachdown(db, 'levelup') // levelup === db\n```\n\nUse a visitor function:\n\n```js\nconst down = reachdown(db, function (db, type) {\n return db.someProperty && type !== 'levelup'\n})\n```\n\n## API\n\n### `db = reachdown(db[, visit][, strict = false])`\n\nThe `db` argument is required and must be a recent-ish `levelup`, `abstract-leveldown` or `subleveldown` instance. The `visit` argument can be:\n\n- A string, to find the first `db` with a matching type\n- A function, to find the first `db` for which `visit` returns a truthy value\n- Omitted or falsy, to find the innermost `db`.\n\nIf `visit` is non-falsy and no matching `db` is found, `reachdown` returns `null` unless `strict` is `false` in which case it returns the innermost `db`.\n\n### `bool = reachdown.is(db, visit)`\n\nUtility to determine the type of `db` without reaching down. The `visit` argument is the same as above, i.e. a string or a function. Example:\n\n```js\nif (reachdown.is(db, 'levelup')) {\n // ..\n}\n```\n\nWhich is the same as the following, except that `reachdown.is(..)` also works on older versions that don't have a `type` property:\n\n```js\nif (db.type === 'levelup') {\n // ..\n}\n```\n\n## Supported Types\n\n- `levelup` (>= 0.0.2 only if db is open, otherwise >= 2.0.0)\n- `encoding-down` (>= 1)\n- `deferred-leveldown` (>= 0.3.0 only if db is open, otherwise >= 2.0.0)\n- `subleveldown` (>= 4)\n- `multileveldown` (TBD)\n- Yours?\n\nImplementations of `abstract-leveldown` can declare a type like so:\n\n```js\nMyLeveldown.prototype.type = 'my-leveldown'\n```\n\nSo that consumers can find that layer:\n\n```js\nvar down = MyLeveldown()\nvar db = levelup(down)\n\nreachdown(db, 'my-leveldown') === down\n```\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install reachdown\n```\n\n## License\n\n[MIT](LICENSE.md) © 2019-present Vincent Weevers\n","readmeFilename":"README.md"}