Skip to content

Commit da72b86

Browse files
committed
Version 1.1.0
1 parent fff6fbd commit da72b86

6 files changed

Lines changed: 202 additions & 119 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
## [Unreleased][unreleased]
44

5+
## [1.1.0][] - 2026-03-08
6+
7+
- Remove metautil dependency; library is now zero-dependency
8+
- Treat null/undefined values argument as empty object
9+
- Add package `exports` field for modern Node.js
10+
- Improve TypeScript declarations (TemplateStringsArray, TickplateTemplate)
11+
- Refactor tests to node:test with `test()`
12+
- Add edge-case tests (null/undefined, empty template, single placeholder)
13+
- CI: run on push to master
14+
- README: API docs, ESM example, zero-dependency note
15+
516
## [1.0.9][] - 2025-12-17
617

718
- Add node.js 24 and 25 to CI, remove 21
@@ -50,7 +61,8 @@
5061

5162
## [0.0.x][] Pre-release versions
5263

53-
[unreleased]: https://github.com/metarhia/tickplate/compare/v1.0.9...HEAD
64+
[unreleased]: https://github.com/metarhia/tickplate/compare/v1.1.0...HEAD
65+
[1.1.0]: https://github.com/metarhia/tickplate/compare/v1.0.9...v1.1.0
5466
[1.0.9]: https://github.com/metarhia/tickplate/compare/v1.0.8...v1.0.9
5567
[1.0.8]: https://github.com/metarhia/tickplate/compare/v1.0.7...v1.0.8
5668
[1.0.7]: https://github.com/metarhia/tickplate/compare/v1.0.6...v1.0.7

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017-2025 Metarhia contributors
3+
Copyright (c) 2017-2026 Metarhia contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
[![npm downloads/month](https://img.shields.io/npm/dm/tickplate.svg)](https://www.npmjs.com/package/tickplate)
77
[![npm downloads](https://img.shields.io/npm/dt/tickplate.svg)](https://www.npmjs.com/package/tickplate)
88

9-
## Usage
9+
Zero-dependency back-tick templates using property names instead of expressions.
10+
Part of the [Metarhia](https://github.com/metarhia) stack.
11+
12+
## Installation
1013

11-
- Install: `npm install tickplate`
12-
- Require: `const t = require('tickplate');`
13-
- Place tag `t` before templated string
14+
```bash
15+
npm install tickplate
16+
```
1417

15-
## Examples:
18+
## Usage
19+
20+
Place tag `t` before a template literal. Placeholders use property names (strings)
21+
as keys; pass a data object to the returned function to render.
1622

1723
```js
1824
const t = require('tickplate');
@@ -31,18 +37,58 @@ const data = {
3137
const templ = t`${'hello'} ${'myFriend'}, great ${'positions'} of Rome`;
3238

3339
console.log(templ(data));
40+
// Ave! Marcus Aurelius, great emperor, philosopher, writer of Rome
41+
```
42+
43+
### ESM
44+
45+
```js
46+
import t from 'tickplate';
47+
48+
const templ = t`Hello ${'name'}!`;
49+
console.log(templ({ name: 'World' }));
50+
// Hello World!
51+
```
52+
53+
## API
54+
55+
### `t(strings, ...keys)`
56+
57+
Tagged template literal. Returns a function `(values, opts?) => string`.
58+
59+
- **Placeholders**: `${'key'}` — property name from the data object.
60+
- **Default values**: `${'key=value'}` — JSON-parsable default when the key is
61+
missing. Example: `${'greeting="Hello"'}` or `${'count=0'}`.
62+
- **Arrays**: Values are joined with `,` by default. Use `opts.delimiter` to
63+
customize (e.g. `{ delimiter: ', ' }`).
64+
65+
### `templ(values, opts?)`
66+
67+
Renders the template.
68+
69+
- **values**: Data object. Keys not present render as empty string. `null` and
70+
`undefined` are treated as `{}`.
71+
- **opts.delimiter**: String (or coercible value) used to join array elements.
72+
Default: `','`.
73+
74+
## Examples
75+
76+
### With delimiter
77+
78+
```js
3479
console.log(templ(data, { delimiter: ', ' }));
80+
// Ave! Marcus Aurelius, great emperor, philosopher, writer of Rome
3581
```
3682

37-
With default values provided (optionally):
83+
### With default values
3884

3985
```js
40-
const t = require('tickplate');
86+
const templ = t`${'greeting='} ${'person="Marcus Aurelius"'}, great ${'positions=["emperor", "philosopher"]'} of Rome from ${'ruleFrom=161'} to ${'ruleTo=180'} AD`;
4187

4288
const data = {
4389
greeting: 'Valē!',
4490
person: {
45-
name: 'Lucius Aurelius Verus',
91+
name: 'Lucius Verus',
4692
toString() {
4793
return this.name;
4894
},
@@ -52,13 +98,12 @@ const data = {
5298
ruleTo: 169,
5399
};
54100

55-
const templ = t`${'greeting='} ${'person="Marcus Aurelius"'}, great ${'positions=["emperor", "philosopher"]'} of Rome from ${'ruleFrom=161'} to ${'ruleTo=180'} AD`;
56-
57101
console.log(templ(data));
102+
// Valē! Lucius Verus, great brother,emperor,co-emperor of Rome from 161 to 180 AD
58103
```
59104

60105
## License & Contributors
61106

62-
Copyright (c) 2017-2025 [Metarhia contributors](https://github.com/metarhia/tickplate/graphs/contributors).
63-
Tickplate is [MIT licensed](./LICENSE).\
107+
Copyright (c) 2017-2026 [Metarhia contributors](https://github.com/metarhia/tickplate/graphs/contributors).
108+
Tickplate is [MIT licensed](./LICENSE).
64109
Tickplate is a part of [Metarhia](https://github.com/metarhia) technology stack.

SECURITY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
| Version | Supported |
66
| ------- | ------------------ |
77
| 0.0.x | :x: |
8-
| 1.0.x | :white_check_mark: |
8+
| 1.0.x | :x: |
9+
| 1.1.x | :white_check_mark: |
910

1011
## Reporting a Vulnerability
1112

0 commit comments

Comments
 (0)