{"_id":"import-modules","_rev":"3519230","name":"import-modules","description":"Import all modules in a directory","dist-tags":{"latest":"3.2.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2024-08-27T20:54:56.000Z","created":"2017-05-21T11:15:15.624Z","3.2.0":"2023-01-04T00:01:43.679Z","3.1.0":"2022-03-16T07:28:55.510Z","3.0.0":"2022-03-10T09:28:56.656Z","2.1.0":"2020-12-20T09:38:47.799Z","2.0.0":"2019-10-03T08:14:34.999Z","1.1.0":"2017-05-21T11:15:15.624Z"},"users":{"rocket0191":true,"atomgao":true,"rubiadias":true,"tomgao365":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-files.git"},"versions":{"3.2.0":{"name":"import-modules","version":"3.2.0","description":"Import all modules in a directory","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-files.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["import","require","files","modules","all","directory","folder","js","paths","multiple","index"],"devDependencies":{"ava":"^2.4.0","tsd":"^0.19.1","xo":"^0.25.3"},"xo":{"ignores":["fixture"]},"types":"./index.d.ts","gitHead":"fc622bb003526da636f44dc0e581274568c61a26","bugs":{"url":"https://github.com/sindresorhus/import-files/issues"},"homepage":"https://github.com/sindresorhus/import-files#readme","_id":"import-modules@3.2.0","_nodeVersion":"14.21.1","_npmVersion":"8.19.2","dist":{"shasum":"4acd64b303784b56acef82c348b9f1cdb9d9a95c","size":2520,"noattachment":false,"key":"/import-modules/-/import-modules-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-modules/download/import-modules-3.2.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-modules_3.2.0_1672790503444_0.06333773746989868"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-04T00:06:49.649Z","publish_time":1672790503679,"_cnpm_publish_time":1672790503679},"3.1.0":{"name":"import-modules","version":"3.1.0","description":"Import all modules in a directory","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-files.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["import","require","files","modules","all","directory","folder","js","paths","multiple","index"],"devDependencies":{"ava":"^2.4.0","tsd":"^0.19.1","xo":"^0.25.3"},"xo":{"ignores":["fixture"]},"types":"./index.d.ts","gitHead":"93e94e985c83a9d504a6571914c9fe9ff2489e99","bugs":{"url":"https://github.com/sindresorhus/import-files/issues"},"homepage":"https://github.com/sindresorhus/import-files#readme","_id":"import-modules@3.1.0","_nodeVersion":"16.14.0","_npmVersion":"8.3.2","dist":{"shasum":"b3940f9305c40b620098ed0a5287ea49336b1105","size":2514,"noattachment":false,"key":"/import-modules/-/import-modules-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-modules/download/import-modules-3.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-modules_3.1.0_1647415735335_0.6614279848347715"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-16T07:29:00.801Z","publish_time":1647415735510,"_cnpm_publish_time":1647415735510},"3.0.0":{"name":"import-modules","version":"3.0.0","description":"Import all modules in a directory","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-files.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava"},"keywords":["import","require","files","modules","all","directory","folder","js","paths","multiple","index"],"devDependencies":{"ava":"^2.4.0","xo":"^0.25.3"},"xo":{"ignores":["fixture"]},"gitHead":"c465830adba3f8b27e4d8deae65024c85d24266f","bugs":{"url":"https://github.com/sindresorhus/import-files/issues"},"homepage":"https://github.com/sindresorhus/import-files#readme","_id":"import-modules@3.0.0","_nodeVersion":"16.14.0","_npmVersion":"8.3.2","dist":{"shasum":"0667da04e17e44fc5081feefc99b0e55f95dbeac","size":2263,"noattachment":false,"key":"/import-modules/-/import-modules-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-modules/download/import-modules-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-modules_3.0.0_1646904536518_0.3645539106469762"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-10T09:30:02.591Z","publish_time":1646904536656,"_cnpm_publish_time":1646904536656},"2.1.0":{"name":"import-modules","version":"2.1.0","description":"Import all modules in a directory","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-files.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava"},"keywords":["import","require","files","modules","all","directory","folder","js","paths","multiple","index"],"devDependencies":{"ava":"^2.4.0","xo":"^0.25.3"},"xo":{"ignores":["fixture"]},"gitHead":"7a79bb113b2db5be3e6ef9dcbc060f5a6a5c7fca","bugs":{"url":"https://github.com/sindresorhus/import-files/issues"},"homepage":"https://github.com/sindresorhus/import-files#readme","_id":"import-modules@2.1.0","_nodeVersion":"15.4.0","_npmVersion":"6.14.9","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"abe7df297cb6c1f19b57246eb8b8bd9664b6d8c2","size":2311,"noattachment":false,"key":"/import-modules/-/import-modules-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-modules/download/import-modules-2.1.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-modules_2.1.0_1608457127655_0.7776579378835198"},"_hasShrinkwrap":false,"publish_time":1608457127799,"_cnpm_publish_time":1608457127799},"2.0.0":{"name":"import-modules","version":"2.0.0","description":"Import all modules in a directory","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-files.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava"},"keywords":["import","require","files","modules","all","directory","folder","js","paths","multiple","index"],"devDependencies":{"ava":"^2.4.0","xo":"^0.25.3"},"gitHead":"399eaab58bf7d06b70a44cf94435f4de3740cfef","bugs":{"url":"https://github.com/sindresorhus/import-files/issues"},"homepage":"https://github.com/sindresorhus/import-files#readme","_id":"import-modules@2.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"9c1e13b4e7a15682f70a6e3fa29534e4540cfc5d","size":2301,"noattachment":false,"key":"/import-modules/-/import-modules-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-modules/download/import-modules-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-modules_2.0.0_1570090474851_0.11424652361687437"},"_hasShrinkwrap":false,"publish_time":1570090474999,"_cnpm_publish_time":1570090474999},"1.1.0":{"name":"import-modules","version":"1.1.0","description":"Import all modules in a directory","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/import-files.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["import","require","files","modules","all","directory","dir","folder","js","paths","multiple","index"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"d5de22939ec105fe74f1747675158a5a83a0f2e6","bugs":{"url":"https://github.com/sindresorhus/import-files/issues"},"homepage":"https://github.com/sindresorhus/import-files#readme","_id":"import-modules@1.1.0","_shasum":"748db79c5cc42bb9701efab424f894e72600e9dc","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.8.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"748db79c5cc42bb9701efab424f894e72600e9dc","size":2346,"noattachment":false,"key":"/import-modules/-/import-modules-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/import-modules/download/import-modules-1.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/import-modules-1.1.0.tgz_1495365315449_0.014575158944353461"},"directories":{},"publish_time":1495365315624,"_hasShrinkwrap":false,"_cnpm_publish_time":1495365315624}},"readme":"# import-modules\n\n> Import all modules in a directory\n\n*This package is intentionally simple. Not interested in more features.*\n\n## Install\n\n```\n$ npm install import-modules\n```\n\n## Usage\n\n```\n.\n└── directory\n    ├── foo-bar.js\n    └── baz-faz.js\n```\n\n```js\nconst importModules = require('import-modules');\n\nconst modules = importModules('directory');\n\nconsole.log(modules);\n//=> {fooBar: [Function], bazFaz: [Function]}\n```\n\n## API\n\n### importModules(directory?, options?)\n\n#### directory\n\nType: `string`\\\nDefault: `__dirname`\n\nDirectory to import modules from. Unless you've set the `fileExtensions` option, that means any `.js`, `.json`, `.node` files, in that order. Does not recurse. Ignores the caller file and files starting with `.` or `_`.\n\n#### options\n\nType: `object`\n\n##### camelize\n\nType: `boolean`\\\nDefault: `true`\n\nConvert dash-style names (`foo-bar`) and snake-style names (`foo_bar`) to camel-case (`fooBar`).\n\n##### fileExtensions\n\nType: `string[]`\\\nDefault: `['.js', '.json', '.node']`\n\nFile extensions to look for. Order matters.\n\n## Related\n\n- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path\n- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory\n- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily\n","_attachments":{},"homepage":"https://github.com/sindresorhus/import-files#readme","bugs":{"url":"https://github.com/sindresorhus/import-files/issues"},"license":"MIT"}