Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
pegjs-require-import
Advanced tools
A simple require extension for PEG.js that supports importing syntax
If you're using webpack, it's recommended to use pegjs-import-loader
npm install --save-dev pegjs-require-import
parser.pegjs:
{
const str = 'This is just an example string';
function concat(a, b) {
return a.concat(b);
}
}
Expression
= head:Term tail:(_ ("+" / "-") _ Term)* {
return tail.reduce(function(result, element) {
if (element[1] === "+") { return result + element[3]; }
if (element[1] === "-") { return result - element[3]; }
}, head);
}
Factor
= "(" _ expr:Expression _ ")" { return expr; }
/ Integer
@import './base-rules.pegjs'
@import './keywords.pegjs'
Import syntax is the same as in pegjs-import-loader
const pegjs_require = require('pegjs-require-import');
const parser = pegjs_require('./parser.pegjs', {
format: 'commonjs',
dependencies: {
_: 'lodash'
}
});
const result = parser.parse(content);
Type: object
See more about PEG.js options
FAQs
PEG.js Require Extension
We found that pegjs-require-import 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.