JSPM

string-format-obj

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

Replace tokens from a string with values of an object

Package Exports

  • string-format-obj

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

Readme

string-format-obj

Replace tokens from a string with values of an object.

$ npm install --save string-format-obj
var format = require('string-format-obj');

format('{greeting} {thing}!', {
  greeting: 'Hello',
  thing: 'world'
});
// Hello world!

If you want to cache the string

var formatFunc = format('{greeting} {thing}!');

formatFunc({
  greeting: 'Howdy',
  thing: 'doody'
});
// Howdy doody!