{
  "_id": "find-root",
  "maintainers": [],
  "keywords": [
    "fs",
    "get",
    "find",
    "closest",
    "package",
    "module",
    "base",
    "root"
  ],
  "dist-tags": {
    "latest": "1.1.0"
  },
  "author": {
    "name": "jsdnxx"
  },
  "_rev": "24-2346e7b01a0a131852501bb6066bf35a",
  "description": "find the closest package.json",
  "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",
  "repository": {
    "type": "git",
    "url": "git+ssh://git@github.com/js-n/find-root.git"
  },
  "users": {
    "itonyyo": true,
    "backnight": true,
    "flumpus-dev": true
  },
  "bugs": {
    "url": "https://github.com/js-n/find-root/issues"
  },
  "license": "MIT",
  "versions": {
    "0.1.0": {
      "name": "find-root",
      "author": {
        "name": "AgileMD",
        "email": "hello@agilemd.com"
      },
      "contributors": [
        {
          "name": "jden",
          "email": "jason@denizac.org"
        }
      ],
      "version": "0.1.0",
      "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@github.com:agilemd/find-root.git"
      },
      "license": "MIT",
      "devDependencies": {
        "chai": "~1.6.0",
        "mocha": "~1.9.0",
        "moquire": "~1.5.4"
      },
      "bugs": {
        "url": "https://github.com/agilemd/find-root/issues"
      },
      "homepage": "https://github.com/agilemd/find-root",
      "_id": "find-root@0.1.0",
      "dist": {
        "shasum": "525352ded5f22f8672375479547a6809352d880e",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/find-root/-/find-root-0.1.0.tgz",
        "integrity": "sha512-RatO/N/iPbUTViCYT61ls6RqXw7gm1A3QxTfLHiMg+Mm6BpW7IoVEWVEt4OcxxUHvlO/Sd1TjQmNhI3rR4W8XQ==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIClwfGQ1G+0uGVfb8r6Bhe5CHZhtiXOtiFOCIAa6oAfgAiBQkXcH7u7Si9q+ZTEe8fSfRCxnS5wLEUntJEth9TkVJA=="
          }
        ]
      },
      "_from": ".",
      "_npmVersion": "1.3.14",
      "_npmUser": {
        "name": "jden",
        "email": "jason@denizac.org"
      },
      "maintainers": [
        {
          "name": "jden",
          "email": "jason@denizac.org"
        }
      ],
      "directories": {}
    },
    "0.1.1": {
      "name": "find-root",
      "author": {
        "name": "AgileMD",
        "email": "hello@agilemd.com"
      },
      "contributors": [
        {
          "name": "jden",
          "email": "jason@denizac.org"
        }
      ],
      "version": "0.1.1",
      "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@github.com:agilemd/find-root.git"
      },
      "license": "MIT",
      "devDependencies": {
        "chai": "~1.6.0",
        "mocha": "~1.9.0",
        "moquire": "~1.5.4"
      },
      "bugs": {
        "url": "https://github.com/agilemd/find-root/issues"
      },
      "homepage": "https://github.com/agilemd/find-root",
      "_id": "find-root@0.1.1",
      "dist": {
        "shasum": "f636d46f3e75f085f3289eb7c7791e5039a377ca",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/find-root/-/find-root-0.1.1.tgz",
        "integrity": "sha512-Yl0dRW9hUEpDyOvTw7C8pzNDfzdL5vK00mcnT21A6Pm0Dn5D6u5xJhhz/9pkh9mbba0+hPkf2C9m0m91FLtJCA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQCvXz83/zo8do/LVrNAQZnHv7MtYFh9STdKU06+7+6pYgIhAKiLFfX2xrV0azLyOK+WcYt9Q/Xo2C6m7ZMPcKZbExxy"
          }
        ]
      },
      "_from": ".",
      "_npmVersion": "1.3.14",
      "_npmUser": {
        "name": "jden",
        "email": "jason@denizac.org"
      },
      "maintainers": [
        {
          "name": "jden",
          "email": "jason@denizac.org"
        }
      ],
      "directories": {}
    },
    "0.1.2": {
      "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": "https://archive.ito.gov.ir/npm/_packages/find-root/-/find-root-0.1.2.tgz",
        "integrity": "sha512-GyDxVgA61TZcrgDJPqOqGBpi80Uf2yIstubgizi7AjC9yPdRrqBR+Y0MvK4kXnYlaoz3d+SGxDHMYVkwI/yd2w==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQD+pK1uMMCo1SByTCgOCzB7eblnxlZcS3PHEF9ES6e21wIhAPmqvgcPOc73g6ET4g586TbF6Ust0fTCjR9eM34M2xkG"
          }
        ]
      },
      "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": {}
    },
    "1.0.0": {
      "name": "find-root",
      "author": {
        "name": "AgileMD",
        "email": "hello@agilemd.com"
      },
      "contributors": [
        {
          "name": "jden",
          "email": "jason@denizac.org"
        }
      ],
      "version": "1.0.0",
      "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": "1c0c9813e26520a8857fe7522b9e04fad05362c2",
      "bugs": {
        "url": "https://github.com/agilemd/find-root/issues"
      },
      "homepage": "https://github.com/agilemd/find-root#readme",
      "_id": "find-root@1.0.0",
      "_shasum": "962ff211aab25c6520feeeb8d6287f8f6e95807a",
      "_from": ".",
      "_npmVersion": "3.5.3",
      "_nodeVersion": "5.6.0",
      "_npmUser": {
        "name": "jden",
        "email": "jason@denizac.org"
      },
      "dist": {
        "shasum": "962ff211aab25c6520feeeb8d6287f8f6e95807a",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/find-root/-/find-root-1.0.0.tgz",
        "integrity": "sha512-6fkVew54iP/VjbdCZXcyYJJrlqs/TNxSCoqK4Nj+ogFbSORcVJHGLXVkhjzZanGujOylky+WgVEBpq6n/jSIrw==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQCDUBQn19wGNL3w2ZTNU7da/lXJDn5+H0Fa89I/aRIZ8QIgYE2SBbXdfAUWciViWmnS5I7X8qW+O7lr9ZNPs0etpQ4="
          }
        ]
      },
      "maintainers": [
        {
          "name": "jden",
          "email": "jason@denizac.org"
        }
      ],
      "_npmOperationalInternal": {
        "host": "packages-9-west.internal.npmjs.com",
        "tmp": "tmp/find-root-1.0.0.tgz_1456090856016_0.6876039081253111"
      },
      "directories": {}
    },
    "1.1.0": {
      "name": "find-root",
      "author": {
        "name": "jsdnxx"
      },
      "version": "1.1.0",
      "description": "find the closest package.json",
      "keywords": [
        "fs",
        "get",
        "find",
        "closest",
        "package",
        "module",
        "base",
        "root"
      ],
      "main": "index.js",
      "scripts": {
        "pretest": "standard",
        "test": "mocha"
      },
      "repository": {
        "type": "git",
        "url": "git+ssh://git@github.com/js-n/find-root.git"
      },
      "license": "MIT",
      "devDependencies": {
        "chai": "^4.0.2",
        "mocha": "^3.4.2",
        "moquire": "^1.5.5",
        "standard": "^10.0.2"
      },
      "gitHead": "853727496c7846456cee13f3bf9079ba978bc858",
      "bugs": {
        "url": "https://github.com/js-n/find-root/issues"
      },
      "homepage": "https://github.com/js-n/find-root#readme",
      "_id": "find-root@1.1.0",
      "_npmVersion": "5.0.4",
      "_nodeVersion": "8.1.2",
      "_npmUser": {
        "name": "jsdnxx",
        "email": "jason@denizac.org"
      },
      "dist": {
        "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",
        "shasum": "abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/find-root/-/find-root-1.1.0.tgz",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIE1hKa5znXkuNBi87U7bO/SmQcwJX+H4SvEYDmXDA4tlAiBTDJIHzuTU7FiLg7jAZNpH3NkrKvC/WwxIzdBsWzk0GA=="
          }
        ]
      },
      "maintainers": [
        {
          "name": "jsdnxx",
          "email": "jason@denizac.org"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/find-root-1.1.0.tgz_1498771558761_0.5412233145907521"
      },
      "directories": {}
    }
  },
  "name": "find-root",
  "time": {
    "modified": "2026-05-13T07:03:17.027Z",
    "created": "2013-12-05T21:36:50.922Z",
    "0.1.0": "2013-12-05T21:36:51.954Z",
    "0.1.1": "2013-12-05T21:57:44.408Z",
    "0.1.2": "2016-02-21T21:40:45.618Z",
    "1.0.0": "2016-02-21T21:40:59.218Z",
    "1.1.0": "2017-06-29T21:25:58.908Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/js-n/find-root#readme"
}