{"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":"http://registry-npm.ywwl.com/reachdown/download/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="}],"size":2598,"noattachment":false,"key":"/reachdown/-/reachdown-1.0.0.tgz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/reachdown_1.0.0_1567877220172_0.7486319189561244"},"_hasShrinkwrap":false,"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","publish_time":1567877220318,"_cnpm_publish_time":1567877220318,"dist-tags":{"latest":"1.1.0"}}