Skip to content

Usage Guides ​

These guides show you how to use Rakexl in your projects, from basic expression evaluation to advanced Monaco Editor integration.

Getting Started ​

Getting Started Guide ​

Learn the basics of Rakexl, installation, and your first expressions. Perfect for newcomers to JEXL.

JavaScript Usage ​

Comprehensive guide to using Rakexl as an expression evaluator in your JavaScript/TypeScript applications.

Integration Guides ​

Monaco Editor Integration ​

Complete guide to integrating JEXL with Monaco Editor for rich IDE experience with syntax highlighting, IntelliSense, and hover documentation.

Advanced Usage ​

Advanced patterns, performance optimization, error handling, and extending Rakexl with custom functionality.

Quick Examples ​

Expression Evaluation ​

javascript
import jexl from 'rakexl';

const data = { users: [{ name: "Alice", age: 28 }, { name: "Bob", age: 32 }] };
const result = jexl.evalSync('users|filter("value.age > 30")|map("value.name")', data);
// ["Bob"]

Monaco Editor Setup ​

typescript
import * as monaco from "monaco-editor";
import { Monaco } from "rakexl";

Monaco.registerJexlLanguage(monaco);
const editor = Monaco.createJexlEditor(monaco, container, {
  value: 'users|filter("value.active")|map("value.name")',
  theme: "vs-dark"
});

String Processing ​

javascript
const text = "  Hello World  ";
const result = jexl.evalSync('text | trim | lowercase | split(" ") | join("-")', { text });
// "hello-world"

Mathematical Operations ​

javascript
const numbers = [1, 2, 3, 4, 5];
const stats = jexl.evalSync('{
  sum: numbers | sum,
  average: numbers | average,
  max: numbers | max,
  count: numbers | length
}', { numbers });
// { sum: 15, average: 3, max: 5, count: 5 }

Common Use Cases ​

Data Transformation ​

Transform API responses, filter arrays, and manipulate objects with powerful expression chains.

Form Validation ​

Create dynamic validation rules using JEXL expressions that can be stored and evaluated at runtime.

Configuration Logic ​

Build flexible configuration systems where business rules are expressed as JEXL expressions.

Template Processing ​

Process templates with dynamic content using JEXL expressions for calculations and formatting.

Query Building ​

Create dynamic queries and filters using JEXL expressions that can be safely evaluated.

Choose Your Guide ​

Each guide builds on the previous ones, so feel free to jump around based on your needs!

Released under the MIT License.