
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@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
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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.