mirror of
https://github.com/gorules/zen.git
synced 2026-11-29 08:06:51 +00:00
4.1 KiB
4.1 KiB
| 1 | expression (string);input (json 5);output (json 5) | ||||||
|---|---|---|---|---|---|---|---|
| 2 | # Boolean | ||||||
| 3 | # Number | ||||||
| 4 | > 5;{$: 10};true | ||||||
| 5 | < 10;{$: 5};true | ||||||
| 6 | >= 10;{$: 10};true | ||||||
| 7 | <= 5;{$: 5};true | ||||||
| 8 | [-10..0];{$: 0};true | ||||||
| 9 | (-10..0];{$: -10};false | ||||||
| 10 | [-10..0);{$: -10};true | ||||||
| 11 | (-10..0);{$: 0};false | ||||||
| 12 | [-15..-5];{$: -4.99};false | ||||||
| 13 | [-5..5];{$: 5};true | ||||||
| 14 | [-6..6];{$: 5};true | ||||||
| 15 | [-5..5];{$: 5};true | ||||||
| 16 | [0..0];{$: 5};false | ||||||
| 17 | > 5 and < 10;{$: 5};false | ||||||
| 18 | <= 10 and > 5;{$: 10};true | ||||||
| 19 | >= 10 or < 5;{$: 10};true | ||||||
| 20 | <= 5 or >= 10;{$: 10};true | ||||||
| 21 | [-10..0] and > -5;{$: -5};false | ||||||
| 22 | [-10..0] and > -5;{$: -4.99};true | ||||||
| 23 | (-10..0] or > 0;{$: -10};false | ||||||
| 24 | [-10..0) and > -5;{$: -5};false | ||||||
| 25 | (-10..0) or > 0;{$: 5};true | ||||||
| 26 | [-15..-5] and <= -10;{$: -10};true | ||||||
| 27 | [-5..5] or > 0;{$: 5};true | ||||||
| 28 | [-5..5] or < 0;{$: 5.01};false | ||||||
| 29 | [-5..5] and > 0;{$: 5};true | ||||||
| 30 | [0..0] and < 5;{$: 0};true | ||||||
| 31 | > 10 or < -5;{$: 5};false | ||||||
| 32 | > 10 | < -5;{$: 15};true | |||||
| 33 | <= -10 and >= -15;{$: -5};false | ||||||
| 34 | # Numeric expressions | ||||||
| 35 | # More complex scenarios | ||||||
| 36 | # String expressions | ||||||
| 37 | 'GB' | 'US';{$: 'US'};true | |||||
| 38 | 'GB' | 'US';{$: 'FR'};false | |||||
| 39 | # Template string | ||||||
| 40 | `sum of numbers ${sum([1 | 2 | 3])}`;{ $: 'sum of numbers 6' };true | ||||
| 41 | `reference env: ${a}`;{ $: 'reference env: example' | a:'example'};true | |||||
| 42 | `uppercase inner ${upper('string')}`;{$: 'uppercase inner STRING'};true | ||||||
| 43 | # String Slice | ||||||
| 44 | # Type conversion | ||||||
| 45 | argMax(items | #.m | #.a);{ $: 'B' | items: [{ m: 'A' | a: 1 } | { m: 'B' | a: 2 }] };true |
| 46 | argMin(items | #.m | #.a);{ $: 'B' | items: [{ m: 'A' | a: 1 } | { m: 'B' | a: 2 }] };false |
| 47 | skew([0 | 0 | 0 | 0 | 5]);{ $: 1.5 };true | ||
| 48 | kurtosis([0 | 0 | 0 | 0 | 5]);{ $: 0.25 };true | ||
| 49 | countDistinctApprox(items | #.c);{ $: 2 | items: [{ c: 'GB' } | { c: 'DE' } | { c: 'GB' }] };true | ||
| 50 | percentileApprox(items | #.v | 0.5);{ $: 0.99 | items: [{ v: 1 } | { v: 1 }] };true | ||
| 51 | join(tags | ' | ');{ $: 'a | b' | tags: ['a' | 'b'] };true | |
| 52 | join(tags);{ $: 'a | b' | tags: ['a' | 'b'] };false | |||
| 53 | join(tags);{ $: 'a | b' | tags: ['a' | null | 'b'] };true | ||
| 54 | percentileApprox([1 | 1] | 0.5);{ $: 0.99 };true | ||||
| 55 | first(items | #.v > 1).id;{ $: 2 | items: [{ id: 1 | v: 1 } | { id: 2 | v: 2 }] };true | |
| 56 | argMax(items | #.a).m;{ $: 'B' | items: [{ m: 'A' | a: 1 } | { m: 'B' | a: 2 }] };true |