{"id":26825083,"url":"https://github.com/chancehudson/not-index","last_synced_at":"2025-06-15T21:20:14.398Z","repository":{"id":57312090,"uuid":"91037638","full_name":"chancehudson/not-index","owner":"chancehudson","description":"Require all lowercase-file.js files that are not index.js","archived":false,"fork":false,"pushed_at":"2022-05-23T05:33:25.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T06:57:04.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chancehudson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-12T01:18:53.000Z","updated_at":"2022-01-20T21:30:13.000Z","dependencies_parsed_at":"2022-09-13T18:33:55.583Z","dependency_job_id":null,"html_url":"https://github.com/chancehudson/not-index","commit_stats":null,"previous_names":["jchancehud/not-index","chancehudson/not-index"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Fnot-index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Fnot-index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Fnot-index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chancehudson%2Fnot-index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chancehudson","download_url":"https://codeload.github.com/chancehudson/not-index/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246302211,"owners_count":20755548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-30T10:19:10.601Z","updated_at":"2025-03-30T10:19:11.142Z","avatar_url":"https://github.com/chancehudson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# not-index\nRequire all `lowercase-filenames.js` that are not `index.js`\n\nThis package makes including directories easier by making `require('./dir')`\nreturn an array of required files\n\nExample `dir/index.js`\n```js\n// Synchronous\nmodule.exports = require('not-index')(__dirname);\n\n// Promised - using async fs call for reading the directory\n// All require calls still block though\nmodule.exports = require('not-index').promise(__dirname);\n\n// Access subdirectory\n// Arguments will be put into path.join\nmodule.exports = require('not-index')([__dirname, 'subdir'])\n\n// Access subdirectory and use a custom regex\nmodule.exports = require('not-index')([__dirname, 'subdir'], /[a-z0-9]\\.js/)\n```\n\nExample: the current directory contains the following files. Entries with a\ntrailing slash are directories.\n```\nmy-dir/\n  file.js\n  file-with-dashes.js\n  file.with.js\n  file.with\n  file.js.notjs\n  index.js\n  tmp/\n  zzz/\n```\n\nThe default file matching regex is `/^(?!index)[0-9a-z\\-]+\\.js$/`. This can be overridden by passing a regex as the last argument (see above).\n\nSynchronous\n```js\nconst requires = require('not-index')(__dirname);\n\n// requires is an array with the following:\n[\n  require('./file.js'),\n  require('./file-with-dashes.js'),\n  require('./file.with.js')\n]\n```\n\nAsynchronous\n```js\nrequire('not-index')\n  .promise()\n  .then(requires =\u003e {\n    // requires is the same as above but the asynchronous fs call is used for\n    // reading the current directory\n  });\n```\n\nExample exporting classes by name on a single object\n```js\nconst requires = require('not-index')(__dirname);\n\nmodule.exports = requires.reduce((_classes, _class) =\u003e {\n  return {\n    ..._classes,\n    [_class.name]: _class,\n  }\n}, {})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchancehudson%2Fnot-index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchancehudson%2Fnot-index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchancehudson%2Fnot-index/lists"}