indexed-template

1.0.0 • Public • Published

Indexed Template

Process indexed template literals.

Example

let template = require('indexed-template');
 
let text = template`Hello ${0}!`('Sandy');
// Hello Sandy!
 
let fn = template`${0} knows ${1}, and ${1} knows ${0}.`;
 
fn('Elizabeth', 'Francis');
fn('Jake', 'Jim');
// Elizabeth knows Francis, and Francis knows Elizabeth.
// Jake knows Jim, and Jim knows Jake.

Installation

$ npm install indexed-template

API

var template = require('indexed-template');

templatetemplate literal(...values))

  • template literal {string.raw} A template literal where each expression evaluates to an integer
  • parameter {...*} value: A value to be placed into the literal string matching the indexed value to the expressions integer.
  • returns string: A string representing the template populated with the values.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i indexed-template

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • lm3