๐Ÿ“ฆ n8n-io / tournament

โ˜… 60 stars โ‘‚ 12 forks ๐Ÿ‘ 60 watching โš–๏ธ Apache License 2.0
๐Ÿ“ฅ Clone https://github.com/n8n-io/tournament.git
HTTPS git clone https://github.com/n8n-io/tournament.git
SSH git clone git@github.com:n8n-io/tournament.git
CLI gh repo clone n8n-io/tournament
Ivรกn Ovejero Ivรกn Ovejero refactor: Remove `@n8n/riot-tmpl` dependency and `tmplDiff` method (#23) 603758e 7 months ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ .vscode
๐Ÿ“ src
๐Ÿ“ test
๐Ÿ“„ .editorconfig
๐Ÿ“„ .eslintrc.js
๐Ÿ“„ .gitignore
๐Ÿ“„ .prettierignore
๐Ÿ“„ .prettierrc.js
๐Ÿ“„ jest.config.js
๐Ÿ“„ LICENSE.md
๐Ÿ“„ package.json
๐Ÿ“„ pnpm-lock.yaml
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.json
๐Ÿ“„ README.md

@n8n/tournament

Tournament is an output-compatible rewrite of riot-tmpl for template expression evaluation.

Installation

pnpm add @n8n/tournament

Features

  • Compatible with riot-tmpl expressions
  • 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.