Files: 49c6e5459b68f2a30bcecf7727b8c9a99cfe4e79 / lib / module.js
447 bytesRaw
1 | const { set } = require('libnested') |
2 | |
3 | module.exports = Module |
4 | |
5 | function Module (definition) { |
6 | const { path, gives, needs, create } = definition |
7 | var module = { gives, needs, create } |
8 | if (!gives) { |
9 | module.gives = {} |
10 | set(module.gives, path, true) |
11 | module.create = (api) => { |
12 | const exports = create(api) |
13 | var globalExports = {} |
14 | set(globalExports, path, exports) |
15 | return globalExports |
16 | } |
17 | } |
18 | return module |
19 | } |
20 |
Built with git-ssb-web