{"name":"find-root","author":{"name":"AgileMD","email":"hello@agilemd.com"},"contributors":[{"name":"jden","email":"jason@denizac.org"}],"version":"0.1.2","description":"find the closest package.json","keywords":["package","module","base","root"],"main":"index.js","scripts":{"test":"node node_modules/mocha/bin/mocha"},"repository":{"type":"git","url":"git+ssh://git@github.com/agilemd/find-root.git"},"license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.9.0","moquire":"~1.5.4"},"gitHead":"2e125a772883d8da1201b35b3d2f44b338f47841","bugs":{"url":"https://github.com/agilemd/find-root/issues"},"homepage":"https://github.com/agilemd/find-root#readme","_id":"find-root@0.1.2","_shasum":"98d2267cff1916ccaf2743b3a0eea81d79d7dcd1","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.6.0","_npmUser":{"name":"jden","email":"jason@denizac.org"},"dist":{"shasum":"98d2267cff1916ccaf2743b3a0eea81d79d7dcd1","tarball":"http://registry-npm.ywwl.com/find-root/download/find-root-0.1.2.tgz","integrity":"sha512-GyDxVgA61TZcrgDJPqOqGBpi80Uf2yIstubgizi7AjC9yPdRrqBR+Y0MvK4kXnYlaoz3d+SGxDHMYVkwI/yd2w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+pK1uMMCo1SByTCgOCzB7eblnxlZcS3PHEF9ES6e21wIhAPmqvgcPOc73g6ET4g586TbF6Ust0fTCjR9eM34M2xkG"}],"size":2237,"noattachment":false,"key":"/find-root/-/find-root-0.1.2.tgz"},"maintainers":[{"name":"jden","email":"jason@denizac.org"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/find-root-0.1.2.tgz_1456090841354_0.014418847160413861"},"directories":{},"readme":"# find-root\nrecursively find the closest package.json\n\n[![Build Status](https://travis-ci.org/js-n/find-root.svg?branch=master)](https://travis-ci.org/js-n/find-root)\n\n## usage\nSay you want to check if the directory name of a project matches its\nmodule name in package.json:\n\n```js\nconst path = require('path')\nconst findRoot = require('find-root')\n\n// from a starting directory, recursively search for the nearest\n// directory containing package.json\nconst root = findRoot('/Users/jsdnxx/Code/find-root/tests')\n// => '/Users/jsdnxx/Code/find-root'\n\nconst dirname = path.basename(root)\nconsole.log('is it the same?')\nconsole.log(dirname === require(path.join(root, 'package.json')).name)\n```\n\nYou can also pass in a custom check function (by default, it checks for the\nexistence of `package.json` in a directory). In this example, we traverse up\nto find the root of a git repo:\n```js\nconst fs = require('fs')\n\nconst gitRoot = findRoot('/Users/jsdnxx/Code/find-root/tests', function (dir) {\n  return fs.existsSync(path.resolve(dir, '.git'))\n})\n```\n\n\n## api\n\n### `findRoot: (startingPath : string, check?: (dir: string) => boolean) => string`\n\nReturns the path for the nearest directory to `startingPath` containing\na `package.json` file, eg `/foo/module`.\n\nIf `check` is provided, returns the path for the closest parent directory\nwhere `check` returns true.\n\nThrows an error if no `package.json` is found at any level in the\n`startingPath`.\n\n\n## installation\n```sh\n> npm install find-root\n```\n\n## running the tests\n\nFrom package root:\n```sh\n> npm install\n> npm test\n```\n\n## contributors\n\n- jsdnxx\n\n\n## license\nMIT. (c) 2017 jsdnxx\n","publish_time":1456090845618,"_cnpm_publish_time":1456090845618,"dist-tags":{"latest":"1.1.0"}}