JSPM

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

String variable substitution

Package Exports

  • supplant

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 (supplant) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Supplant

Build Status

Variable substitution on the string.

It scans through the string looking for expressions enclosed in {{ }} braces. If an expression is found, use it as a key on the object, and if the key has a string value or number value, it is substituted for the bracket expression and it repeats.

Installation

with component:

$ component install bredele/supplant

with nodejs:

$ npm install supplant

API

supplant(str, obj)

return the interpolation of a string with an object.

Example

Basic

supplant('my job at {{ company }} is {{ status }}', {
  company : 'Github',
  status : 'awesome'
});

//my job at Github is awesome

Expressions

supplant('{{ company.toUpperCase() }}', {
  company : 'github'
});

//GITHUB

License

MIT