Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
consolidate-jstransformer
Advanced tools
Consolidate-compatible API to use JSTransformers.
Replace the consolidate
package with consolidate-jstransformer
.
var cons = require('consolidate')
var cons = require('consolidate-jstransformer')
Use consolidate-jstransformer
the same way you would use Consolidate:
var cons = require('consolidate-jstransformer');
cons.swig('views/page.html', { user: 'tobi' }, function(err, html){
if (err) throw err;
console.log(html);
});
Or without options / local variables:
var cons = require('consolidate-jstransformer');
cons.swig('views/page.html', function(err, html){
if (err) throw err;
console.log(html);
});
To dynamically pass the engine, simply use the subscript operator and a variable:
var cons = require('consolidate-jstransformer')
, name = 'swig';
cons[name]('views/page.html', { user: 'tobi' }, function(err, html){
if (err) throw err;
console.log(html);
});
Render strings rather than files:
var cons = require('consolidate-jstransformer')
, name = 'swig';
cons[name].render('Hello {{ user }}', { user: 'tobi' }, function(err, html){
if (err) throw err;
console.log(html);
});
If no callback function is provided, a Promise will be returned.
var cons = require('consolidate-jstransformer');
cons.swig('views/page.html', { user: 'tobi' })
.then(function (html) {
console.log(html);
})
.catch(function (err) {
throw err;
});
MIT
v1.0.0: 2018-02-15
FAQs
Consolidate-compatible API to use JSTransformers.
The npm package consolidate-jstransformer receives a total of 4 weekly downloads. As such, consolidate-jstransformer popularity was classified as not popular.
We found that consolidate-jstransformer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.