
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@beyonk/load-all
Advanced tools
Loads the contents of sub-directories of a specified directory into an object or an array, suitable for mass loading of small modules from a filesystem.
This library is used extensively at Beyonk for loading route mappings, validations, error objects, and anywhere where a large number of small modules needs to be loaded.
npm i -D @beyonk/load-all
The library only has two methods, both of which amalgamate all exported items from a list of files.
exportDir which results in a hash of export name -> function (), so that a directory structured thusly:
/my-dir
|-- library1
| `-- index.js
|-- library2and3
| `-- index.js
| ...
can be imported with:
const exported = exportDir('/my-dir')
// {
// library1: (exported as `library` from library1.js),
// library2: (exported as `library2` from library2and3.js),
// library3: (exported as `library3` from library2and3.js)
// }
includeDir results in a concatenated array of the contents of files (which should export an array themselves), so that a directory structured thusly:
/routes
|-- routes1
| `-- index.js
|-- routes2and3
| `-- index.js
| ...
can be imported with:
const routes = includeDir('/my-dir')
// [ route1, route2, route3 ]
The library will let you know every file it is loading, if you specify the second parameter to any method:
includeDir('/some-dir', 'route')
will result in log messages similar to the following:
// Adding route from ./some-dir/my-route
You can modify the content of the files you load before it is put into the final hash or array, if you, for instance, would like to capitalise the key names, or add metadata or similar.
const { capitalize } = require('lodash')
includeDir('/some-dir', 'some-label', exported => {
return Object.keys(exported).reduce((acc, exportName) {
acc[capitalize(exportName)] = exported[exportName]
return acc
}, {})
})
You can run the suite of unit tests with
npm run test
code is linted according to @beyonk/eslint-config
FAQs
Loads all files from within a directory
The npm package @beyonk/load-all receives a total of 19 weekly downloads. As such, @beyonk/load-all popularity was classified as not popular.
We found that @beyonk/load-all demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.