Skip to content

Modules

Joakim edited this page Oct 25, 2021 · 17 revisions

Export

A module's last evaluated expression is implicitly exported. By convention, an object.

sum: (a, b) -> a + b
diff: (a, b) -> a - b

[sum, diff]

Import

import module: 'module.kesh'
import [foo]: 'module.kesh'
import [foo as alias]: 'module.kesh'
import [foo, bar]: 'module.kesh'
import 'module.kesh'

The import declaration can also import individual items from the global object.

import [JSON, Promise, Math]
import window
Clone this wiki locally