1.0.8 • Published 5 months ago

tickplate v1.0.8

Weekly downloads
10
License
MIT
Repository
github
Last release
5 months ago

Tickplate - Back-tick templates for JavaScript

ci status codacy snyk npm version npm downloads/month npm downloads

Usage

  • Install: npm install tickplate
  • Require: const t = require('tickplate');
  • Place tag t before templated string

Examples:

const t = require('tickplate');

const data = {
  hello: 'Ave!',
  myFriend: {
    name: 'Marcus Aurelius',
    toString() {
      return this.name;
    },
  },
  positions: ['emperor', 'philosopher', 'writer'],
};

const templ = t`${'hello'} ${'myFriend'}, great ${'positions'} of Rome`;

console.log(templ(data));
console.log(templ(data, { delimiter: ', ' }));

With default values provided (optionally):

const t = require('tickplate');

const data = {
  greeting: 'Valē!',
  person: {
    name: 'Lucius Aurelius Verus',
    toString() {
      return this.name;
    },
  },
  positions: ['brother', 'emperor', 'co-emperor'],
  ruleFrom: 161,
  ruleTo: 169,
};

const templ = t`${'greeting='} ${'person="Marcus Aurelius"'}, great ${'positions=["emperor", "philosopher"]'} of Rome from ${'ruleFrom=161'} to ${'ruleTo=180'} AD`;

console.log(templ(data));

License & Contributors

Copyright (c) 2017-2023 Metarhia contributors. Tickplate is MIT licensed.\ Tickplate is a part of Metarhia technology stack.

1.0.8

5 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

6 years ago

0.0.1

7 years ago