
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@jeanbenitez/logical-expression-parser
Advanced tools
Logical expression parser and evaluates result, suitable for permissions management
This is a logical expression parser for JavaScript, it can parse a logical expression into a AST object and evaluates the result using your token checking function.
OR
AND
()
ParenthesesREGISTED AND (SPECIAL OR INVITED)
REGISTED
, SPECIAL
and INVITED
into your token checking function to get a boolean resultconst LEP = require('@jeanbenitez/lep');
const requirements = 'REGISTED AND (SPECIAL OR INVITED)';
const listA = ['REGISTED', 'INVITED'];
const listB = ['SPECIAL', 'EXPERT'];
const resultA = LEP.parse(requirements, t => listA.includes(t));
const resultB = LEP.parse(requirements, t => listB.includes(t));
console.log({ resultA, resultB });
// { resultA: true, resultB: false }
// Getting AST only
const ast = LEP.ast(requirements);
console.log({ ast });
/*
{
ast: ExpNode {
op: 'AND',
left: ExpNode {
op: 'LITERAL',
literal: 'REGISTED'
},
right: ExpNode {
op: 'OR',
left: [ExpNode],
right: [ExpNode]
}
}
}
*/
FAQs
Logical expression parser and evaluates result, suitable for permissions management
The npm package @jeanbenitez/logical-expression-parser receives a total of 1,615 weekly downloads. As such, @jeanbenitez/logical-expression-parser popularity was classified as popular.
We found that @jeanbenitez/logical-expression-parser 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.