Sanitization + better error reporting
This commit is contained in:
parent
a5e686b059
commit
8d6be0ea00
7 changed files with 221 additions and 211 deletions
12
src/utils.js
12
src/utils.js
|
@ -1,19 +1,7 @@
|
|||
const m = require('makerjs')
|
||||
|
||||
exports.assert = (exp, msg) => {
|
||||
if (!exp) {
|
||||
throw new Error(msg)
|
||||
}
|
||||
}
|
||||
|
||||
exports.deepcopy = (value) => JSON.parse(JSON.stringify(value))
|
||||
|
||||
exports.type = (val) => {
|
||||
if (Array.isArray(val)) return 'array'
|
||||
if (val === null) return 'null'
|
||||
return typeof val
|
||||
}
|
||||
|
||||
const eq = exports.eq = (a=[], b=[]) => {
|
||||
return a[0] === b[0] && a[1] === b[1]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue