JSPM

string-interpolate-polyfill

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q13317F
  • License ISC

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

Package Exports

  • string-interpolate-polyfill
  • string-interpolate-polyfill/index.js

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-polyfill) 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-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"] }
}