{"id":41031146,"url":"https://github.com/kayslay/require_all","last_synced_at":"2026-01-22T10:24:02.481Z","repository":{"id":57354343,"uuid":"99813433","full_name":"kayslay/require_all","owner":"kayslay","description":"An npm module to require all javascript or json files in a directory","archived":false,"fork":false,"pushed_at":"2018-04-25T15:54:59.000Z","size":651,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-10-10T19:48:41.708Z","etag":null,"topics":["javascript","nodejs","npm","recursive-require","require"],"latest_commit_sha":null,"homepage":"","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/kayslay.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-08-09T13:48:28.000Z","updated_at":"2023-06-17T09:17:00.000Z","dependencies_parsed_at":"2022-09-12T04:01:38.617Z","dependency_job_id":null,"html_url":"https://github.com/kayslay/require_all","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kayslay/require_all","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayslay%2Frequire_all","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayslay%2Frequire_all/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayslay%2Frequire_all/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayslay%2Frequire_all/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kayslay","download_url":"https://codeload.github.com/kayslay/require_all/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayslay%2Frequire_all/sbom","scorecard":{"id":552200,"data":{"date":"2025-08-11","repo":{"name":"github.com/kayslay/require_all","commit":"e14a517373d137a3e851d9b6ae92b82edb88df46"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'develop'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T11:11:16.659Z","repository_id":57354343,"created_at":"2025-08-20T11:11:16.659Z","updated_at":"2025-08-20T11:11:16.659Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28661752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","nodejs","npm","recursive-require","require"],"created_at":"2026-01-22T10:24:01.887Z","updated_at":"2026-01-22T10:24:02.473Z","avatar_url":"https://github.com/kayslay.png","language":"JavaScript","readme":"# Require_All\n\nRequire multiple files at a time from a directory. Require is a module to require files from directory and should only be used when requiring multiple files from directory. \n\nIf you need to require a single module from directory or from the `node_modules` directory make use of the Nodejs standard require function.\n\n **require_all** does not have any dependency apart from the ones used in development ([mocha]() \u0026 [chai]()).\n\n## Installation\n\n        $ npm install require_all\n\n## Usage\n\n**require_all** has two modes of operation, Asynchronous and Synchronous mode.\n\n \n ```javascript\n    const requireAll = require('require_all')(module);  //pass in the module so it can get the directory name of the current file\n```\n\n\n### The requireAll function\n#### Arguments:\n- `path` **{String | Array}**\n- `options` **{Object}** optional\n- `callback` **{Functon | String}** optional\n\n##### Path\n\nThe path to directory or an array of paths to directories to require files from. Both relative and absolute paths are supported\n\n##### Options\n\nThe option argument configures certain behaviors of requireAll function. The option is an Object with properties:\n\n- **depth {Boolean}:** Defaults to false. If true it gets the files of sub-directories in the directory of the path.\n\n- **filters {RegExp}:** The default value is `/(\\.js|\\.json)$/`. Requires the files that match the RegExp.\n\n**Note :** If changed the new RegExp value would replace the default, so if js and json files want to matched it must be included in the new RegExp value.\n\n- **exclude {RegExp}** The files to exclude\n\n- **excludeDir {RegExp}** The directories to exclude\n\n#### Callback\n\nThe require_all acts synchronously or asynchronously depending on the parameters passed or not passed as it `callback` parameter.\n\nrequire_all acts synchronously if the callback parameter is not passed or the callback === `'sync'`.\n\n```javascript\nconst RequiredObj = requireAll('path/to/file'[,option])\n//OR\nconst RequiredObj = requireAll('path/to/file'[,option],'sync')\n```\nIf a callback function is passed or the callback string === 'async' require_all acts asynchronously.\n \nA Promise is returned when the callback === \"async\".\n\n ```javascript\n\n    requireAll('path/to/file'[,option],'async')\n    .then(requiredObj=\u003e {/*fulfilled*/})\n    .catch(err=\u003e{/*error handling*/})\n```\n\nOr handle with a callback when the function is passed into the `callback` argument\n\n```javascript\nrequireAll('path/to/file'[,option],(err,requiredObj)=\u003e{\n    if(err){\n        /*error handling*/\n    }\n    /*run the code*/\n})\n```\n\n\n\nDepending on the way this function is used, the object gotten after the all the requiring is done is; let say it called\nRequiredObj.\n\nRequiredObj would be explained in more details\n\n### RequiredObj\n\nRequiredObj is an object that holds all the functions,array, values e.t.c. of the scripts in the folder required.\n\n#### structure of RequiredObj\n\n```javascript\n    RequiredObj = {\n    ['folderBaseName']: {\n            ['filename1'] : ['exported param'],\n            ['filename2'] : ['exported param'] \n        }\n    }\n\n    // path/to/file\n    //file would be the folderBaseName\n    //if we have file1.js , file2.js and file3.json\n\n    //the value of RequireObj = {'file':{\n    //                            file1: [__exported_values__]\n    //                            file2: [__exported_values__]\n    //                            file3: [__exported_values__]\n    //                            }\n\n```\n\n## Example Usage\n\n### Using Require_all Synchronously\n\n```javascript\nvar requireAll = require(\"require_all\")(module);\n//passing an array of paths\nconst obj = requireAll(['../dummy_module/', '../dummy/'],\n    {depth: true, exclude: /((^\\.\\.)|index.js)/, excludeDir: /^child/});\n//passing a single path\nconst obj = requireAll('../dummy_module/',\n    {depth: true, exclude: /((^\\.\\.)|index.js)/, excludeDir: /^child/});\n\nconsole.log(obj);\n```\n\n### Using Require_all Asynchronously\n\n```javascript\nvar requireAll = require(\"require_all\")(module);\n//using as a promise\n requireAll(['../dummy_module/', '../dummy/'],\n    {depth: true, exclude: /((^\\.\\.)|index.js)/, excludeDir: /^child/},'async')\n    .then(obj=\u003e {console.log(obj)})\n    .catch(err=\u003e{console.error(err)});\n //using as a callback\n requireAll(['../dummy_module/', '../dummy/'],\n    {depth: true, exclude: /((^\\.\\.)|index.js)/, excludeDir: /^child/}, (err, obj) =\u003e {\n        if (err) {\n            console.error(err)\n        }\n        console.log(obj)\n    })\n```\n\n### Please report any issues on the projects issues page [here](https://github.com/kayslay/require_all/issues)\n\n### Badewa Kayode\n\n[@kayslaycode](https://twitter.com/Kayslaycode) [github](https://github.com/kayslay) [Badewa Kayode](https://web.facebook.com/badewa.kayode)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayslay%2Frequire_all","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkayslay%2Frequire_all","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayslay%2Frequire_all/lists"}