$when::
expr.json.create (customer)
. (dieselScope[="cart"]
=(cart || {id:customer,items:[]})
)
$when::
expr.json.addItem (sku, quantity)
. (dieselScope[="cart"]
=(cart + {items:{sku:sku,quantity:quantity}})
)
$when::
testing.invcheck
. (payload
="ok"
)
$when::
expr.json.create2 (a, b)
ctx.json (a=a, b=b)
$when::
expr.json.sum2 (a, b)
ctx.json (a=a)
. (aj
=payload
)
ctx.json (b=b)
. (bj
=payload
)
. (payload
=(aj + bj)
)
/$when shipping.package /=> cart/items $map item => inv.get (item.sku,item.quantity})
$when::
expr.simplejson.do (x)
ctx.json (x=x)
$when::
dieseltest.asAttrs (a, b)
. (dieselScope[="res33"]
=(a + b)
)
$when::
test.diesel.rule40
. (student[="address"][="no"]
="65"
)
$when::
test.diesel.isin (x in ["123","234"]
, y not in [1,2]
)
. (dieselScope[="y46"]
=true
)
You can embed and use simple JS scripts like this:
m = parseInt(mths); d = new Date(); d.setMonth(d.getMonth() + m); x=0; // you can use for loops and any other JS construct that // doesn't contain a double curly brace... for(i=0; i < 5; i++) { x = x+i; } return d.toISOString().replace(/T.*/g, '');
return new Date().toISOString().replace(/T.*/g, '');
Get values from input and send back as both payload and as a side effect:
x = students[0].age; y = students[1].age; return x + y;
x = students[0].age; y = students[1].age; return {sum:x + y};
You need to log in to post a comment!