JSPM

interpol8

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q33276F
  • License CC0-1.0

Basic templating by interpolating values into placeholders.

Package Exports

  • interpol8

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

Readme

interpol8

Basic templating by interpolating values into placeholders.

install

npm install interpol8

example

const interpolate = require('interpol8')

interpolate(
  'Hello, {{place}}',
  {place: 'world'}
) // -> 'Hello, world'

// nested, arrays, brackets, dots, whatever, it all works as one would expect
interpolate(
  'Hello, {{[0].foo.bar["places"][1]}}',
  [{foo: bar: {{places: ['', 'world']}}}]
) // -> 'Hello, world'

// custom delimiters
interpolate(
  'Hello, <% place %>',
  {place: 'world'},
  {left: '<%', right: '%>'}
) // -> 'Hello, world'

API

interpolate(template, data, options)

  • template: string
  • data: object
  • options: object
    • left: string, {{ left delimiter
    • right: string, }} right delimiter