Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
mrules-engine
Advanced tools
A package for generating objects via a set of rules.
Please use version 1.3.2 and above as below will be unstable
npm install mrules-engine
const engine = require('mrules-engine');
const exampleRules1 = [{
pathTo: 'data.name',
pathFor: 'name'
}];
const example1 = engine({ data: { name: 'Name' } }, exampleRules1);
console.log(example1);
> { name: 'Name' };
const engine = require('mrules-engine');
const exampleRules2 = [{
pathTo: 'data.name',
pathFor: 'name'
selectorFn: (name) => `My Name: ${name}`
}];
const example2 = engine({ data: { name: 'Name' } }, exampleRules2);
console.log(example2);
> { name: 'My Name: Name' };
const engine = require('mrules-engine');
const exampleRules3 = [{
pathTo: 'data.nameDoesNotExist',
pathFor: 'name',
fallback: 'Fallback Name'
}];
const example3 = engine({ data: { name: 'Name' } }, exampleRules3);
console.log(example3);
> { name: 'Fallback Name' };
const engine = require('mrules-engine');
const exampleRules4 = [{
pathTo: 'data.nameDoesNotExist',
pathFor: 'name',
selectorFn: (name) => `Your Fallback Name: ${name}`,
fallback: 'Fallback Name'
}];
const example4 = engine({ data: { name: 'Name' } }, exampleRules4);
console.log(example4);
> { name: 'Your Fallback Name: Fallback Name' };
const engine = require('mrules-engine');
const exampleRules5 = [{
pathTo: 'data.name',
pathFor: 'name',
selectorFn: (name) => `Forename: ${name}`
}, {
pathTo: 'data.surname',
pathFor: 'surname',
selectorFn: (name) => `Surname: ${name}`
}];
const example5 = engine({ data: { name: 'Foo', surname: 'Bar' } }, exampleRules5);
console.log(example5);
> { name: 'Forename: Foo', surname: 'Surname: Bar' };
FAQs
A package for generating objects via a set of rules.
The npm package mrules-engine receives a total of 4 weekly downloads. As such, mrules-engine popularity was classified as not popular.
We found that mrules-engine 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.