runlet 0.1.0

A semantic executable model for the Runlet orchestration language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
#! expect: ["+14155550100", "+14155550101", "+14155550102"]
#! writes: 2
# The crm shape: validate with a regex, normalize the rest, write only what
# changed (fire-and-forget effect root inside a loop).
contacts = data.contacts()
normalized = for c in contacts limit 4 {
    valid = regex.test(c.phone, "^\\+1[0-9]{10}$")
    digits = regex.replace(c.phone, "[^0-9]", "")
    e164 = c.phone if valid else (("+1" + digits) if text.length(digits) == 10 else ("+" + digits))
    r = write.update({ id: c.id, phone: e164 }) if not valid
    return e164
}
return normalized