mirror of
https://github.com/n8n-io/n8n.git
synced 2026-07-28 03:24:59 +02:00
Co-authored-by: Charlie Kolb <charlie@n8n.io> Co-authored-by: Guillaume Jacquart <jacquart.guillaume@gmail.com> Co-authored-by: Stephen Wright <sjw948@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Bernhard Wittmann <bernhard.wittmann@n8n.io> Co-authored-by: Nikhil Kuriakose <nikhil.kuriakose@n8n.io> Co-authored-by: Albert Alises <albert.alises@gmail.com> Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com> Co-authored-by: Andreas Fitzek <andreas.fitzek@n8n.io> Co-authored-by: Elias Meire <elias@meire.dev> Co-authored-by: Robin Braumann <50590409+bjorger@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: yehorkardash <yehor.kardash@n8n.io> Co-authored-by: Mike Repeć <mike.repec@n8n.io> Co-authored-by: Yuliia Pominchuk <31064937+yuliia-pominchuk@users.noreply.github.com> Co-authored-by: RomanDavydchuk <roman.davydchuk@n8n.io> |
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| .gitignore | ||
| biome.jsonc | ||
| eslint.config.mjs | ||
| LICENSE.md | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| vite.config.ts | ||
@n8n/tournament
Tournament is an output-compatible rewrite of riot-tmpl for template expression evaluation.
Installation
pnpm add @n8n/tournament
Features
- Compatible with
riot-tmplexpressions - ES6 syntax support, e.g. arrow functions and template literals
- Built-in AST hooks for expression manipulation
- TypeScript support
Usage
import { Tournament } from '@n8n/tournament';
const tournament = new Tournament();
// simple expressions
tournament.execute('{{ 1 + 2 }}', {}); // 3
// with data context
tournament.execute('{{ user.name }}', { user: { name: 'John' } }); // 'John'
// template strings
tournament.execute('{{ `Hello ${user.name}!` }}', { user: { name: 'John' } }); // 'Hello John!'
// error handling
const tournament = new Tournament((error) => {
console.error('Expression error:', error);
});
Release
To release, update the version in package.json and run:
npm version {version}
npm publish
You will need permissions to publish via n8n's npm org.