Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es6-template-strings

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-template-strings

Compile and resolve template strings notation as specified in ES6

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38K
decreased by-14.87%
Maintainers
1
Weekly downloads
 
Created
Source

es6-template-strings

Compile and resolve template strings notation as specified in ES6

Usage


var template = require('es6-template-strings');

// Hello WORLD!
console.log(template('Hello ${place.toUpperCase()}!', { place: "World" }));

// You can reuse same templates:
var compile = require('es6-template-strings/compile')
  , resolveToString = require('es6-template-strings/resolve-to-string')

  , compiled = compile('Welcome to ${siteName}, you are visitor number ${visitorNumber}!');

// Welcome to MySite, you are visitor number 137!
console.log(resolveToString(compiled, { siteName: "MySite", visitorNumber: 137 }));

// Welcome to OtherSite, you are visitor number 777!
console.log(resolveToString(compiled, { siteName: "OtherSite", visitorNumber: 777 }));

// You may prepare custom tag functions
var resolve = require('es6-template-strings/resolve');

var customTag = function (literals/*, …substitutions*/) {
	// Process input and return result string
};

// Output template processed by customTag:
customTag.apply(null, resolve(compiled, {/* context */}));

Installation

NPM

In your project path:

$ npm install es6-template-strings
Browser

You can easily bundle es6-template-strings for browser with modules-webmake

Tests Build Status

$ npm test

Keywords

FAQs

Package last updated on 28 Apr 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc