Outlines progress

This commit is contained in:
Bán Dénes 2020-06-30 22:29:14 +02:00
parent fad615045a
commit 8da97611e4
3 changed files with 106 additions and 19 deletions

View file

@ -24,6 +24,11 @@ const detect_unexpected = exports.detect_unexpected = (obj, name, expected) => {
}
}
exports.in = (raw, name, arr) => {
assert(arr.includes(raw), `Field "${name}" should be one of [${arr.join(', ')}]!`)
return raw
}
const numarr = exports.numarr = (raw, name, length) => {
assert(type(raw) == 'array' && raw.length == length, `Field "${name}" should be an array of length ${length}!`)
raw = raw.map(val => val || 0)