1.3.0 released 29 September 2026. Latest patch: 1.3.2, released 6 November 2026 (a build-tooling refresh with no API change). 1.3.1, released 13 October 2026, fixed attribute text.
The short version
- Twelve built-in expression helpers. Check a list's length, count matching items, filter, sort, total values and join labels directly in a binding.
- Reactive reads inside helpers. Helpers can read an observable array and observable fields on its items. Changing a checkbox updates a count that depends on it.
- Fresh arrays for derived lists.
where,sortByandpluckreturn new arrays. Your source collection keeps its own contents and order. - Correct attribute text in 1.3.1. Template placeholders in ordinary attributes are no longer escaped twice, keeping tooltips, accessible labels and data attributes readable.
Twelve helpers, ready to use
You can call these in binding expressions without registering them first:
| Helper | What it does |
|---|---|
len(list) |
Returns the length of an array or string, or the size of a Set or Map. |
includes(list, value) |
Checks whether an array contains a value or a string contains a substring. |
some(list, key, value) |
Checks whether any item matches. Leave out value to test whether the field is truthy. |
every(list, key, value) |
Checks whether every item matches. An empty list returns true. |
count(list, key, value) |
Counts matching items. Leave out value for truthy fields, or both arguments to count all items. |
where(list, key, value) |
Returns matching items in a new array. Leave out value to use field truthiness. |
sum(list, key) |
Totals numeric values, or a named numeric field. Non-numeric values contribute zero. |
pluck(list, key) |
Returns a new array containing each item's named field. |
sortBy(list, key, direction) |
Returns a sorted copy. Ascending is the default; pass 'desc' for descending. |
first(list) |
Returns the first item, or undefined for an empty list. |
last(list) |
Returns the last item, or undefined for an empty list. |
join(list, separator) |
Joins items into a string, with ', ' as the default separator. |
A field name can be a dotted path such as 'address.town'. Where a helper accepts a field key, null selects the item itself: where(numbers, null, 2) finds items equal to 2.
Counts and filters with less setup
A to-do list can show a summary and a filtered preview using the same collection. The snippets below use the npm module import; see the setup guide for browser module and script-tag options.
import {observable, observableArray, applyBindings} from 'domma-reactive';
const todos = observableArray([
{id: 1, title: 'Read the guide', done: observable(true)},
{id: 2, title: 'Build a small page', done: observable(false)},
{id: 3, title: 'Share it with Tom & Jerry', done: observable(false)}
]);
const handle = applyBindings({todos}, document.querySelector('#app'));
Place this HTML on the page before running the module:
<div id="app">
<p data-bind-text="count(todos, 'done') + ' of ' + len(todos) + ' complete'"></p>
<ul data-each="todos.value key=id">
<li>
<label>
<input type="checkbox" data-model="done.value">
<span data-bind-text="title"></span>
</label>
</li>
</ul>
<h2>Still to do</h2>
<p data-if="!len(where(todos, 'done', false))">Everything is done.</p>
<ul data-each="where(todos, 'done', false) key=id">
<li title="Task: {{title}}" data-bind-text="title"></li>
</ul>
</div>
Ticking an item updates both the count and the filtered preview. There is no separate computed needed for each short binding.
The helpers accept todos directly and read the observable value themselves. They also read each item's done.value and track that dependency. This is a defined helper behaviour; ordinary bindings still use explicit .value paths, such as data-model="done.value".
For more involved rules, reusable business logic or transformations shared across several parts of a page, computed remains useful.
Your source collection stays intact
where filters into a new array. sortBy sorts a copy. pluck collects field values into a new array. None of these helpers mutates the input collection.
That lets one view show the original list while another shows a filtered or sorted projection. A keyed data-each can consume the projection directly, as above. Rows that remain in that rendered list retain their elements; filtering an item out removes its row. Keep drafts in the view model if they must survive that removal.
A helper registered with registerHelper under the same name takes precedence over the built-in. Unregistering it restores the built-in helper.
Fixed in 1.3.1: readable attribute values
A template placeholder such as title="{{name}}" is eventually written through setAttribute, which expects text. Previously, the renderer supplied an HTML-escaped string and the attribute displayed the escape sequence instead of the intended character.
For example, the to-do preview above should give its final row a tooltip reading Task: Share it with Tom & Jerry. The patch prevents the ampersand from being escaped twice. The same fix applies to accessible labels and data-* attributes populated by template placeholders, including those in data-each rows.
HTML-like characters remain text in the attribute. This fix changes how that text is decoded before assignment.
Upgrading
npm install domma-reactive@1.3.2
For a browser module without a bundler, use the published file directly:
import {observable, applyBindings} from 'https://cdn.jsdelivr.net/npm/domma-reactive@1.3.2/dist/domma-reactive.esm.js';
Existing applications can continue to use their current observables, computeds, bindings and component APIs. The new helpers are available automatically after upgrading. Check any custom helpers named len, count, where or another built-in name: your registered implementation continues to take precedence.
The binding expression language still uses a parser rather than eval or a Function constructor. See the manual's expression and helper reference.
Also included from 1.2
The 1.2 releases introduced object and array literals in expressions, warnings for bare observables used as binding values, and safer handling of unsupported nested virtual blocks. The 1.2.1 patch improved the warning for bindings inside an unkeyed template block.
Those behaviours carry forward into 1.3. The safety guide, expression guide and keyed-list chapter explain the relevant rules.
