-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (33 loc) · 851 Bytes
/
index.js
File metadata and controls
39 lines (33 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict'
const core = require('./lib/core')
core.sha256 = require('js-sha256')
core.helper = require('./lib/helper')
core.parse = require('./lib/parse')(core)
core.compile = require('./lib/compile')(core)
core.abi = require('./lib/abi')(core)
module.exports = {
compile(ml, config = {}) {
const {
abi_format = 'compact'
, ml_format = 'compact'
, macros = true
} = config
if (abi_format && abi_format !== 'compact') {
throw new Error(`${abi_format} is not a valid abi_format`)
}
if (ml_format && ml_format !== 'compact') {
throw new Error(`${ml_format} is not a valid ml_format`)
}
if (macros && macros !== true) {
throw new Error(`${macros} is not a valid macros`)
}
return core.compile.script(ml, {
abi_format
, ml_format
, macros
})
}
, abi: core.abi
, version: '0.0.1b'
, _core: core
}