{"_id":"req-from","_rev":"102233","name":"req-from","description":"Require a module like `require()` but from a given path","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-06-03T10:35:55.000Z","created":"2015-12-06T16:36:51.612Z","3.0.0":"2018-11-08T08:09:26.532Z","2.0.0":"2017-04-28T09:04:58.087Z","1.0.1":"2015-12-06T20:06:45.255Z","1.0.0":"2015-12-06T16:36:51.612Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/req-from.git"},"versions":{"3.0.0":{"name":"req-from","version":"3.0.0","description":"Require a module like `require()` but from a given path","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/req-from.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"keywords":["require","resolve","path","module","from","like","import","path"],"dependencies":{"resolve-from":"^3.0.0"},"devDependencies":{"ava":"*","xo":"*"},"gitHead":"6ee88e81131a96ddb3f943645e86105e5eccc8d6","bugs":{"url":"https://github.com/sindresorhus/req-from/issues"},"homepage":"https://github.com/sindresorhus/req-from#readme","_id":"req-from@3.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"966c842a806f1ec18968936118e2eaf97f32ece9","size":1824,"noattachment":false,"key":"/req-from/-/req-from-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/req-from/download/req-from-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/req-from_3.0.0_1541664566414_0.07078807190468384"},"_hasShrinkwrap":false,"deprecated":"Renamed to `import-from`.","publish_time":1541664566532,"_cnpm_publish_time":1541664566532},"2.0.0":{"name":"req-from","version":"2.0.0","description":"Require a module like `require()` but from a given path","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/req-from.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["require","resolve","path","module","from","like","import","path"],"dependencies":{"resolve-from":"^3.0.0"},"devDependencies":{"ava":"*","xo":"*"},"gitHead":"6ee88e81131a96ddb3f943645e86105e5eccc8d6","bugs":{"url":"https://github.com/sindresorhus/req-from/issues"},"homepage":"https://github.com/sindresorhus/req-from#readme","_id":"req-from@2.0.0","_shasum":"d74188e47f93796f4aa71df6ee35ae689f3e0e70","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.7.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"d74188e47f93796f4aa71df6ee35ae689f3e0e70","size":1852,"noattachment":false,"key":"/req-from/-/req-from-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/req-from/download/req-from-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/req-from-2.0.0.tgz_1493370297812_0.7743019156623632"},"directories":{},"publish_time":1493370298087,"_cnpm_publish_time":1493370298087,"_hasShrinkwrap":false},"1.0.1":{"name":"req-from","version":"1.0.1","description":"Require a module like `require()` but from a given path","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/req-from"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["require","resolve","path","module","from","like","path"],"dependencies":{"resolve-from":"^2.0.0"},"devDependencies":{"ava":"*","xo":"*"},"gitHead":"c75bd5936b908973c054731c2826d831817eeb8f","bugs":{"url":"https://github.com/sindresorhus/req-from/issues"},"homepage":"https://github.com/sindresorhus/req-from","_id":"req-from@1.0.1","_shasum":"bf81da5147947d32d13b947dc12a58ad4587350e","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"bf81da5147947d32d13b947dc12a58ad4587350e","size":1812,"noattachment":false,"key":"/req-from/-/req-from-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/req-from/download/req-from-1.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1449432405255,"_cnpm_publish_time":1449432405255,"_hasShrinkwrap":false},"1.0.0":{"name":"req-from","version":"1.0.0","description":"Require a module like `require()` but from a given path","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/req-from"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["require","resolve","path","module","from","like","path"],"dependencies":{"resolve-from":"^2.0.0"},"devDependencies":{"ava":"*","xo":"*"},"gitHead":"bcfa8f84a6d2107e512aedf6d69ce2a05ce29686","bugs":{"url":"https://github.com/sindresorhus/req-from/issues"},"homepage":"https://github.com/sindresorhus/req-from","_id":"req-from@1.0.0","_shasum":"a52cd9fd0eab8cfe9668db814c62c5ff56811ca2","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"a52cd9fd0eab8cfe9668db814c62c5ff56811ca2","size":1790,"noattachment":false,"key":"/req-from/-/req-from-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/req-from/download/req-from-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1449419811612,"_cnpm_publish_time":1449419811612,"_hasShrinkwrap":false}},"readme":"# req-from [![Build Status](https://travis-ci.org/sindresorhus/req-from.svg?branch=master)](https://travis-ci.org/sindresorhus/req-from)\n\n> Require a module like [`require()`](https://nodejs.org/api/globals.html#globals_require) but from a given path\n\n\n## Install\n\n```\n$ npm install --save req-from\n```\n\n\n## Usage\n\n```js\nconst reqFrom = require('req-from');\n\n// There is a file at `./foo/bar.js`\n\nreqFrom('foo', './bar');\n```\n\n\n## API\n\n### reqFrom(fromDir, moduleId)\n\nLike `require()`, throws when the module can't be found.\n\n### reqFrom.silent(fromDir, moduleId)\n\nReturns `null` instead of throwing when the module can't be found.\n\n#### fromDir\n\nType: `string`\n\nDirectory to require from.\n\n#### moduleId\n\nType: `string`\n\nWhat you would use in `require()`.\n\n\n## Tip\n\nCreate a partial using a bound function if you want to require from the same `fromDir` multiple times:\n\n```js\nconst reqFromFoo = reqFrom.bind(null, 'foo');\n\nreqFromFoo('./bar');\nreqFromFoo('./baz');\n```\n\n\n## Related\n\n- [req-cwd](https://github.com/sindresorhus/req-cwd) - Require a module from the current working directory\n- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path\n- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory\n- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point\n- [lazy-req](https://github.com/sindresorhus/lazy-req) - Require modules lazily\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n","_attachments":{},"homepage":"https://github.com/sindresorhus/req-from#readme","bugs":{"url":"https://github.com/sindresorhus/req-from/issues"},"license":"MIT"}