{"_id":"import-from","_rev":"49279","name":"import-from","description":"Import a module like with `require()` but from a given path","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-06-03T10:15:07.000Z","created":"2017-05-21T09:28:31.839Z","4.0.0":"2021-06-01T07:50:05.141Z","3.0.0":"2019-04-27T10:30:33.530Z","2.1.0":"2017-05-21T09:28:31.839Z"},"users":{"danielbayley":true,"rocket0191":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-from.git"},"versions":{"4.0.0":{"name":"import-from","version":"4.0.0","description":"Import a module like with `require()` but from a given path","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-from.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=12.2"},"scripts":{"test":"xo && ava && tsd"},"keywords":["require","resolve","path","module","from","like","import","path"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"c411bcaaa489069d9e17c232aa4d01f716ae7bd7","bugs":{"url":"https://github.com/sindresorhus/import-from/issues"},"homepage":"https://github.com/sindresorhus/import-from#readme","_id":"import-from@4.0.0","_nodeVersion":"16.0.0","_npmVersion":"7.10.0","dist":{"shasum":"2710b8d66817d232e16f4166e319248d3d5492e2","size":2043,"noattachment":false,"key":"/import-from/-/import-from-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-from/download/import-from-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-from_4.0.0_1622533805046_0.05245298393180442"},"_hasShrinkwrap":false,"publish_time":1622533805141,"_cnpm_publish_time":1622533805141},"3.0.0":{"name":"import-from","version":"3.0.0","description":"Import a module like with `require()` but from a given path","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-from.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["require","resolve","path","module","from","like","import","path"],"dependencies":{"resolve-from":"^5.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"fb039dcf3fe69bb3d395be4b5db2ab9367efcca7","bugs":{"url":"https://github.com/sindresorhus/import-from/issues"},"homepage":"https://github.com/sindresorhus/import-from#readme","_id":"import-from@3.0.0","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"055cfec38cd5a27d8057ca51376d7d3bf0891966","size":2087,"noattachment":false,"key":"/import-from/-/import-from-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-from/download/import-from-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-from_3.0.0_1556361033390_0.7896283829815032"},"_hasShrinkwrap":false,"publish_time":1556361033530,"_cnpm_publish_time":1556361033530},"2.1.0":{"name":"import-from","version":"2.1.0","description":"Import a module like with `require()` but from a given path","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-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":"c7d2eb8ebdb94873445632b2273d2d52030a7dc8","bugs":{"url":"https://github.com/sindresorhus/import-from/issues"},"homepage":"https://github.com/sindresorhus/import-from#readme","_id":"import-from@2.1.0","_shasum":"335db7f2a7affd53aaa471d4b8021dee36b7f3b1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"335db7f2a7affd53aaa471d4b8021dee36b7f3b1","size":1863,"noattachment":false,"key":"/import-from/-/import-from-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-from/download/import-from-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-from-2.1.0.tgz_1495358911498_0.48687195940874517"},"directories":{},"publish_time":1495358911839,"_hasShrinkwrap":false,"_cnpm_publish_time":1495358911839}},"readme":"# import-from\n\n> Import a module like with [`require()`](https://nodejs.org/api/modules.html#modules_require_id) but from a given path\n\n## Install\n\n```\n$ npm install import-from\n```\n\n## Usage\n\n```js\nconst importFrom = require('import-from');\n\n// There is a file at `./foo/bar.js`\n\nimportFrom('foo', './bar');\n```\n\n## API\n\n### importFrom(fromDirectory, moduleId)\n\nLike `require()`, throws when the module can't be found.\n\n### importFrom.silent(fromDirectory, moduleId)\n\nReturns `undefined` instead of throwing when the module can't be found.\n\n#### fromDirectory\n\nType: `string`\n\nDirectory to import from.\n\n#### moduleId\n\nType: `string`\n\nWhat you would use in `require()`.\n\n## Tip\n\nCreate a partial using a bound function if you want to import from the same `fromDir` multiple times:\n\n```js\nconst importFromFoo = importFrom.bind(null, 'foo');\n\nimportFromFoo('./bar');\nimportFromFoo('./baz');\n```\n\n## Related\n\n- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import 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- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily\n- [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module\n","_attachments":{},"homepage":"https://github.com/sindresorhus/import-from#readme","bugs":{"url":"https://github.com/sindresorhus/import-from/issues"},"license":"MIT"}