Skip to content

Bulksets

xval

xval {
    Constant1 = use("module1")
    Constant2 = 12
    Constant3 = "abc"
}

Declares multiple constants with their values set to the result of a use function. Equivalent to declaring each constant individually with const.

xlet

xlet {
    Variable1 = initialValue1
    Variable2 = initialValue2
    Variable3 = initialValue3
}

Declares multiple variables with let and initializes them. Equivalent to declaring each variable individually with let.

xvar

xvar {
    Variable1 = initialValue1
    Variable2 = initialValue2
    Variable3 = initialValue3
}

Declares multiple variables with var and initializes them. Equivalent to declaring each variable individually with var.

xset

player = new Plyr("#video-player")
xset(player) {
    poster      = escapeBackslashes(albumArtPath)
    autoplay    = true
}

Bulk setting of properties to values

The above will transpile to this JS:

player = new Plyr("#video-player")
player.poster = escapeBackslashes(albumArtPath)
player.autoplay = true