{"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":{"integrity":"sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ==","shasum":"2710b8d66817d232e16f4166e319248d3d5492e2","tarball":"http://registry-npm.ywwl.com/import-from/download/import-from-4.0.0.tgz","fileCount":5,"unpackedSize":4909,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgteatCRA9TVsSAnZWagAAPjAP/102c7DSx1nQFmi64xOd\nU2WuDMC3AJMbHuFMcHijKC19XVNb4pLSS8T0TpNBhJ6qo9xJ/hQDGQIHB4rv\nPEMrMmVtjSOcNTyPem9u3mylieKgdKZ8W21BxCvPkv1wgCu2KBwFchniw1bN\nSNeuDAgM1xt+FGJfwcVHizdoEclO+d2It2rEJZk6Hup/Hghu7HIDHAJOtBGg\nX/0PkhDEpvhx0duHdvNUHK5FDORMobcvIRRwRUyt8Q+lzKJeYPx6MNoY84YY\nM4XolDMyIgv675PvXtJLas2G+WOea8HAmhjFVWAXUOjcXU0FkLV1m/WZmUl2\nJYlIrMN6oXWMWC4cRZJB4rojkX3Bey3x8HYuUybWp/anQvB0+XMNyP517lMQ\nprdbWnEvn0nf8DOlYHVhS335czA6e7kq3whf8K/5eXhrGVmztTsPYbP3DTd5\nS34cudihGZgyMHsgNfhndGNt+Ht3pqTIW3gCbfb1ud2rxGHYR1GVELFHHk61\np7k7QjyJvy2Vak52CxXy/wFnlQxGDxUKGSEY5FrGuYSv71sTFNXJXrT/5ush\n1V0A3oP8CNZoka1dBSjleaqbtmvmpmcQug/VT8v52ajlwWneMsESjBdi+snc\nbABc1lcY3mro/qxSlTGIrUOH8EB7IZfuCHyU6OWTl7a+dcjbIzEaHbTiD6o2\nbLYd\r\n=fS6h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjwQKINfd9qAJNd3QJnaTSW89Cin88O/WCvvg0+ln2kAIhAJWW0sQ9hKT9FIQEI/xJSSdpPZme8Gz8bU6HyyrRjPu8"}],"size":2043,"noattachment":false,"key":"/import-from/-/import-from-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-from_4.0.0_1622533805046_0.05245298393180442"},"_hasShrinkwrap":false,"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","publish_time":1622533805141,"_cnpm_publish_time":1622533805141,"dist-tags":{"latest":"4.0.0"}}