Sanitization + better error reporting

This commit is contained in:
Bán Dénes 2020-06-27 20:13:06 +02:00
parent a5e686b059
commit 8d6be0ea00
7 changed files with 221 additions and 211 deletions

View file

@ -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]
}