
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
base-plugins-enhanced
Advanced tools
Error handling and extras for `.use` and `.run` methods of your Base apps. Modifies `.use` method to be able to 1) accept array of functions, 2) options object as second argument. Emits `error` event if some plugin fails.
Error handling and extras for
.useand.runmethods of your Base apps. Modifies.usemethod to be able to 1) accept array of functions, 2) options object as second argument. Emitserrorevent if some plugin fails.
npm i base-plugins-enhanced --save
For more use-cases see the tests
const basePluginsEnhanced = require('base-plugins-enhanced')
Upgrade the built-in plugin system or that comes from base-plugins to have error handling and some little extra stuff. Like you can pass array of plugins to
.usemethod and alsooptionsobject as second argument.
Params
options {Object}: object merge with app.optionsreturns {Function}: plugin executed by .use methodExample
var plugins = require('base-plugins-enhanced')
var Base = require('base')
var app = new Base()
app
.use(plugins())
.use(function foo () {}, { aa: 'bb' })
.use(function bar () {}, { xx: 'yy' })
.use([
function pluginOne () {},
function pluginTwo () {},
], opts)
Add plugin to your base application. See Base's or the base-plugins documentation.
Params
fn {Function|Array}: function or array of functionsopts {Object}: options to be merged with app.optionsreturns {Base}: instance for chainingExample
app.use([
function one () {},
function two () {}
], { foo: 'bar' })
Run the stack of plugins. See more on base-plugins documentation on
.runmethod.
Params
val {Object}: object to be passed to each smart pluginreturns {Base}: instance for chainingExample
app
.use(function foo (app) {
return function (ctx) {
ctx.foo = 'fooooo'
}
}, { first: 'yes' })
.use([
function bar (app) {
return function (ctx) {
ctx.bar = 'barrr'
}
}
function baz (app) {
return function (ctx) {
ctx.qux = 123
}
}
], { multiple: true })
.use(function qux (app) {
app.zzz = 'yyyy'
}, { aaa: bbb })
var obj = { charlike: 'mike' }
app.run(obj)
console.log(app.zzz)
// => 'yyyy'
console.log(obj)
// => { foo: 'fooooo', bar: 'barrr', qux: 123 }
console.log(app.options)
// => { first: 'yes', multiple: true, aaa: 'bbb', charlike: 'mike' }
option, enable and disable… [more](https://github.com/node-base/base-option) | [homepage](https://github.com/node-base/base-option "Adds a few options methods to base, like option, enableanddisable`. See the readme for the full API.").request and .requestAll methods to your base applications for… more | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.
FAQs
Error handling and extras for `.use` and `.run` methods of your Base apps. Modifies `.use` method to be able to 1) accept array of functions, 2) options object as second argument. Emits `error` event if some plugin fails.
The npm package base-plugins-enhanced receives a total of 2 weekly downloads. As such, base-plugins-enhanced popularity was classified as not popular.
We found that base-plugins-enhanced demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.