1.0.5 • Published 7 years ago

templatize-string v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Templatize

Convert additive strings to ES6 template strings.

Example

    'this ' + 'is ' + 'a ' + 'string. ' + testVariable + (testVariable ? 'foo' : 'bar')

Compiles to

    `this is a string. ${testVariable}${(testVariable ? 'foo' : 'bar')}`

Usage

    const templatize = require('templatize-string');
    const foo = 'bar';

    let templatized = templatize('foo is equal to ' + foo).renderWrapped(); // Will return `foo is equal to ${foo}`

Methods

render

Returns templatized string.

    let templatized = templatize('foo is equal to ' + foo).render(); // Will return 'foo is equal to ${foo}'

renderWrapped

Arguments:

  • wrappingChar - The character the rendered string will be wrapped in. Default is `.

Returns templatized string wrapped with the specified character.

    let templatized = templatize('foo is equal to ' + foo).renderWrapped(); // Will return `foo is equal to ${foo}`
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago