Outlines progress
This commit is contained in:
parent
fad615045a
commit
8da97611e4
3 changed files with 106 additions and 19 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue