JSPM

string-interpolate

0.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 81
  • Score
    100M100P100Q68184F
  • License MIT

Simple string interpolation

Package Exports

  • string-interpolate

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string-interpolate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

String interpolate

Simple string interpolation

Install

  • via npm npm install string-interpolate
  • via component component install alexeyraspopov/string-interpolate
  • via bower bower install string-interpolate

API

interpolate(template, data);
  • template - template string. Default delimiters are {}
  • data - simple object

Usage

var interpolate = require('string-interpolate');

interpolate('{ greeting }, { user.name }', {
    greeting: 'Hello',
    user: {
        name: 'Jane'
    }
});

If data is not specified - returns template function

var greet = interpolate('Hello { name }');

greet({ name: 'Jane' }); // Hello Jane
greet({ name: 'Mike' }); // Hello Mike

License

MIT License (c) Alexey Raspopov