UNPKG
subscript
Version:
latest (10.4.17)
10.4.17
10.4.16
10.4.15
10.4.14
10.4.13
10.4.12
10.4.11
10.4.10
10.4.9
10.4.8
10.4.7
10.4.6
10.4.5
10.4.4
10.4.3
10.4.2
10.4.1
10.4.0
10.3.6
10.3.5
10.3.4
10.3.3
10.3.2
10.3.1
10.2.0
10.1.8
10.1.7
10.1.6
10.1.5
10.1.4
10.1.3
10.1.2
10.1.1
10.1.0
10.0.4
10.0.3
10.0.2
10.0.1
10.0.0
9.2.0
9.1.0
9.0.2
9.0.1
9.0.0
8.6.0
8.5.0
8.4.1
8.4.0
8.3.7
8.3.6
8.3.5
8.3.4
8.3.3
8.3.1
8.3.0
8.2.2
8.2.1
8.2.0
8.1.3
8.1.2
8.1.1
8.1.0
8.0.1
8.0.0
7.6.2
7.6.1
7.6.0
7.5.5
7.5.4
7.5.3
7.5.2
7.5.1
7.5.0
7.4.6
7.4.5
7.4.4
7.4.3
7.4.2
7.4.1
7.4.0
7.3.1
7.3.0
7.2.0
7.1.1
7.1.0
7.0.7
7.0.6
7.0.5
7.0.4
7.0.3
7.0.2
7.0.1
7.0.0
6.4.0
6.3.1
6.3.0
6.2.0
6.1.0
6.0.4
6.0.3
6.0.2
6.0.1
6.0.0
5.5.2
5.5.1
5.5.0
5.4.0
5.3.2
5.3.1
5.3.0
5.2.3
5.2.2
5.2.1
5.2.0
5.1.0
5.0.0
4.0.0
3.0.3
3.0.2
3.0.1
3.0.0
2.0.0
1.0.6
1.0.5
1.0.4
1.0.3
0.0.0
Modular expression parser & evaluator
github.com/dy/subscript
dy/subscript
subscript
/
eval
/
if.js
8 lines
(6 loc)
•
260 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
// If/else - eval half
import
{ operator, compile }
from
'../parse.js'
;
operator
(
'if'
,
(
cond, body, alt
) =>
{ cond =
compile
(cond); body =
compile
(body); alt = alt !==
undefined
?
compile
(alt) :
null
;
return
ctx
=>
cond
(ctx) ?
body
(ctx) : alt?.(ctx); });