An open API service indexing awesome lists of open source software.

https://github.com/saber2pr/mod

a module style for js.
https://github.com/saber2pr/mod

module-system

Last synced: 8 months ago
JSON representation

a module style for js.

Awesome Lists containing this project

README

          

# mod

a module style for js.

> do you know monad? :)

```html

```

# API

```ts
function mod(creator: () => Promise): Promise
function mod(
creator: (join: (dep: string) => Promise) => Promise
): Promise
```

1. define a module:

```js
// ./add.js
mod(() => {
const add = (a, b) => a + b
return add
})
```

2. import a module

```js
// ./main.js
mod(async require => {
// import module
const add = await require("./add.js")

console.log(add(1, 2))
})
```

> It looks like the do-block in haskell?

# License

MIT

> Author: saber2pr