Skip to content

Commit c14eae5

Browse files
authored
Update README.md
1 parent 18c6e0a commit c14eae5

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

README.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ fn({ a: 1, b: 3 }) // 7
2424

2525
## Presets
2626

27-
[**Subscript**]() – common expressions:
27+
[**Subscript**](./docs.md#subscript) – common expressions:
2828

2929
```js
3030
import subscript from 'subscript'
3131

3232
subscript('a.b + c * 2')({ a: { b: 1 }, c: 3 }) // 7
3333
```
3434

35-
[**Justin**]() – JSON + expressions + templates + arrows:
35+
[**Justin**](./docs.md#justin) – JSON + expressions + templates + arrows:
3636

3737
```js
3838
import justin from 'subscript/justin.js'
@@ -41,7 +41,7 @@ justin('{ x: a?.b ?? 0, y: [1, ...rest] }')({ a: null, rest: [2, 3] })
4141
// { x: 0, y: [1, 2, 3] }
4242
```
4343

44-
[**Jessie**]() – JSON + expressions + statements, functions (JS subset):
44+
[**Jessie**](./docs.md#jessie) – JSON + expressions + statements, functions (JS subset):
4545

4646
```js
4747
import jessie from 'subscript/jessie.js'
@@ -58,30 +58,8 @@ fn({}) // 120
5858

5959
See [docs](./docs.md#presets) for full description.
6060

61-
## Extension
62-
63-
Add operators, literals or custom syntax:
64-
65-
```js
66-
import { binary, operator, compile } from 'subscript/justin.js'
67-
68-
// add intersection operator
69-
binary('', 80) // register parser
70-
operator('', (a, b) => ( // register compiler
71-
a = compile(a), b = compile(b),
72-
ctx => a(ctx).filter(x => b(ctx).includes(x))
73-
))
74-
```
75-
76-
```js
77-
import justin from 'subscript/justin.js'
78-
justin('[1,2,3] ∩ [2,3,4]')({}) // [2, 3]
79-
```
80-
81-
See [docs.md](./docs.md) for full API.
8261

83-
84-
## Syntax Tree
62+
## Syntax format
8563

8664
Expressions parse to a minimal JSON-compatible syntax tree:
8765

@@ -103,6 +81,26 @@ Three forms:
10381
See [spec.md](./spec.md).
10482

10583

84+
## Extension
85+
86+
Add operators, literals or custom syntax:
87+
88+
```js
89+
import justin, { binary, operator, compile } from 'subscript/justin.js'
90+
91+
// add intersection operator
92+
binary('', 80) // register parser
93+
operator('', (a, b) => ( // register compiler
94+
a = compile(a), b = compile(b),
95+
ctx => a(ctx).filter(x => b(ctx).includes(x))
96+
))
97+
98+
justin('[1,2,3] ∩ [2,3,4]')({}) // [2, 3]
99+
```
100+
101+
See [docs.md](./docs.md) for full API.
102+
103+
106104
## Safety
107105

108106
Blocked by default:

0 commit comments

Comments
 (0)