Alpha status: this repository is ready for public design review and experimental use. The public API is intentionally small and read-only.
Current package release: 0.1.1 (@xcon-chain/*).
XCON Chain is a standalone, read-only expression engine for JSON-like data.
Use it to write small data-binding expressions, render fixture-backed examples, lint generated expressions, and trace how a value was produced. The recommended authoring form is sugar syntax.
import { evaluateSugar, renderSugarTemplate } from '@xcon-chain/core';
const data = {
record: {
products: [{ title: 'Apple', price: 12900 }],
orders: [
{ status: 'paid', total: 12900, items: [{ name: 'Coffee' }] },
{ status: 'pending', total: 8000, items: [{ name: 'Tea' }] }
]
}
};
evaluateSugar('= record.products | first | get "price" | format "#,### KRW"', data);
// "12,900 KRW"
evaluateSugar('= record.orders | filter status "paid" | map total | sum | format "#,### KRW"', data);
// "12,900 KRW"
evaluateSugar([
'let paidOrders = record.orders | filter status "paid"',
'let firstItems = $paidOrders | first | get items',
'return $firstItems | map name | join ", "'
].join('\n'), data);
// "Coffee"
renderSugarTemplate(`fmt "First product: {record.products | first | get 'title'}"`, data);
// "First product: Apple"| Package | Purpose |
|---|---|
@xcon-chain/core |
Read-only parser, evaluator, template renderer, public function registry |
@xcon-chain/trace |
Step-by-step expression tracing and explain output |
@xcon-chain/lint |
Diagnostics for unknown functions, unsupported functions, and sample-data path mismatches |
@xcon-chain/markdown-it |
Executable xcon-chain fenced examples for Markdown |
npm install @xcon-chain/coreOptional packages:
npm install @xcon-chain/trace @xcon-chain/lint @xcon-chain/markdown-itThe public project is a pure expression engine:
same expression + same input data = same output
It deliberately does not persist state, call network APIs, execute actions, read files, access repositories, or touch the DOM. That boundary keeps the npm package deterministic and easy to embed.
npm install
npm test
npm run check:alpha
npm run playgroundThe project is intentionally isolated. It must stay usable as a small public npm package with no private application dependencies.
The browser playground loads its sample expressions from examples/playground-examples.json, so the interactive examples can stay aligned with the documented examples.
The playground links to a separate Markdown preview page at playground/markdown.html. It loads the reusable Markdown examples listed in examples/markdown-preview.json, shows the source and rendered output side by side, and displays external fixture JSON below the preview.