string-interpolate-polyfill
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

string-interpolate-polyfill

Inject mustache.render method as interpolate function to string primitive type

How to use

// js files
require('string-interpolate-polyfill');
const template = 'Hello {{world}}';
const view = {world: 'World!!!'};
console.log(template.interpolate(view));
// ts files
import 'string-interpolate-polyfill';
type View = { world: string }
const template = 'Hello {{world}}';
const view: View = {world: 'World!!!'};
console.log(template.interpolate<View>(view));

You can integrate this directly in tsconfig files like this:

{
  "compilerOptions": { },
  "ts-node": { "require": ["string-interpolate-polyfill"] }
}

Package Sidebar

Install

npm i string-interpolate-polyfill

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

5.49 kB

Total Files

9

Last publish

Collaborators

  • leandroluk