Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
es6-templates
Advanced tools
ES6 template strings compiled to ES5.
Weekly downloads
Readme
Compiles JavaScript written using template strings to use ES5-compatible syntax. For example, this:
var name = "Nicholas",
msg = `Hello, ${name}!`;
console.log(msg); // "Hello, Nicholas!"
compiles to this:
var name = "Nicholas",
msg = "Hello, " + name + "!";
console.log(msg); // "Hello, Nicholas!"
For more information about the proposed syntax, see the TC39 wiki page on template strings.
$ npm install es6-templates
$ node
> var compile = require('es6-templates').compile;
> compile('`Hey, ${name}!`')
{ 'code': ..., 'map': ... }
Without interpolation:
`Hey!`
// becomes
'"Hey!"'
With interpolation:
`Hey, ${name}!`
// becomes
"Hey, " + name + "!"
With a tag expression:
escape `<a href="${href}">${text}</a>`
// becomes
escape(function() {
var strings = ["\u003Ca href=\"", "\"\u003E", "\u003C/a\u003E"];
strings.raw = ["\u003Ca href=\"", "\"\u003E", "\u003C/a\u003E"];
return strings;
}(), href, text);
Or work directly with the AST:
$ node
> var transform = require('es6-templates').transform;
> transform(inputAST)
Transforming ASTs is best done using recast to preserve formatting where possible and for generating source maps.
Browserify support is built in.
$ npm install es6-templates # install local dependency
$ browserify -t es6-templates $file
First, install the development dependencies:
$ npm install
Then, try running the tests:
$ npm test
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Any contributors to the master es6-templates repository must sign the Individual Contributor License Agreement (CLA). It's a short form that covers our bases and makes sure you're eligible to contribute.
When you have a change you'd like to see in the master repository, send a pull request. Before we merge your request, we'll make sure you're in the list of people who have signed a CLA.
FAQs
ES6 template strings compiled to ES5.
The npm package es6-templates receives a total of 361,908 weekly downloads. As such, es6-templates popularity was classified as popular.
We found that es6-templates 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
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.