
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@modernpoacher/rules-runner
Advanced tools
Encapsulate rules in an easily comprehended JSON/JavaScript object literal format.
npm i -P @modernpoacher/rules-runner
if the conditions are met then will execute.
const RulesRunner = require('@modernpoacher/rules-runner')
const config = {
'Must be 16 or older if no adult is present': {
if: {
'person.age': {
lessThan: 16
},
'person.adultPresent': false
},
then: {
'person.error': 'Must be 16 or older if no adult is present',
'errors.all[]': 'person'
}
},
'Must be employed': {
if: {
'company.isEmployed': false
},
then: {
'company.error': 'Must be employed',
'errors.all[]': 'company'
}
}
}
const rulesRunner = new RulesRunner(config)
const values = {
person: {
age: 15,
adultPresent: false
},
company: {
isEmployed: false
}
}
rulesRunner.run(values)
assert.equal(values.person.error, 'Must be 16 or older if no adult is present')
assert.equal(values.company.error, 'Must be employed')
assert.deepEqual(values.errors.all, ['person', 'company'])
if the conditions are not met otherwise will execute.
const RulesRunner = require('@modernpoacher/rules-runner')
const config = {
'Person will be in house if person is tired or hungry': {
if: {
'person.age': {
lessThan: 16
},
'person.adultPresent': false
},
then: {
'person.location': 'house'
},
otherwise: {
'person.location': 'work'
}
}
}
const rulesRunner = new RulesRunner(config)
const values = {
person: {
age: 17,
adultPresent: true
}
}
rulesRunner.run(values)
assert.equal(values.person.location, 'work')
'person.exists': true
'person.firstName': 'John'
'person.age': 21
'person.exists': false
'person.age': { between: [1, 20] }
'person.name': { contains: 'Jr' }
'person.age': { lessThan: 21 }
'person.age': { greaterThan: 20 }
'person.state': { oneOf: ['CA', 'TX', 'NY'] }
'person.state': { anyOf: ['CA', 'TX', 'NY'] }
'person.state': { allOf: ['CA', 'TX', 'NY'] }
'person.name': { matches: '/(john|bob|mary)/i' }
'person.state': { not: 'CA' }`
'person.state': { not: { oneOf: ['CA', 'TX'] } }
FAQs
A business rules engine for Node
We found that @modernpoacher/rules-runner demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.