Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Precedent meta-templating engine, for when you want templates ... for templates.
Precedent works on the concept of "Template Patterns". These are regions of text that are replaced by their template function. Because patterns are defined in a tree data structure, nested patterns (such as <%
, <%=
, <$$
and <
) properly get parsed in the same process run.
So, for instance, you could create a pattern like so:
// Load the precedent library
var libPrecedent = require('../source/Precedent.js').new();
// Add the pattern
libPrecedent.addPattern('{Name', '}', 'David Bowie');
// Parse a string with the pattern
console.log(libPrecedent.parseString('This is just a short message for {Name}.');
// Anything inbetween the start and end is ignored in this case, since it is a string substitution.
console.log(libPrecedent.parseString('This is just a short message for {Name THIS TEXT IS IGNORED}. We hope to ignore the previous text.');
This would output the following to the console:
This is just a short message for David Bowie.
This is just a short message for David Bowie. We hope to ignore the previous text.
Add a pattern to the string processor.
// Pass in a string
libPrecedent.addPattern('{Name', '}', 'David Bowie');
// Or a function
libPrecedent.addPattern('{Name', '}', (pString)=>{return pString.length;});
Each time a pattern is matched, anything between the patternStart
and patternEnd
will be passed into the parse function.
Type: String
The beginning portion of a pattern.
Type: String
The ending portion of a pattern.
Type: String
or Function
Default: Echo content between the pattern start and end.
Parse a string with the processor.
libPrecedent.parseString('This is just a short message for {Name}.'
Type: String
The string of content to parseg
FAQs
Precedent Meta-Templating
We found that precedent 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.