Bringing points stuff up to spec
This commit is contained in:
12
src/utils.js
12
src/utils.js
@@ -1,7 +1,19 @@
|
||||
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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user