Units separated to their own block, and properly tested

This commit is contained in:
Bán Dénes 2021-07-11 13:45:53 +02:00
parent 71efdbe020
commit 452d7c155b
7 changed files with 100 additions and 19 deletions

View file

@ -215,18 +215,7 @@ const perform_mirror = exports._perform_mirror = (point, axis) => {
return ['', null]
}
exports.parse = (config = {}) => {
// parsing units
const raw_units = prep.extend({
u: 19,
cx: 18,
cy: 17
}, a.sane(config.units || {}, 'points.units', 'object')())
const units = {}
for (const [key, val] of Object.entries(raw_units)) {
units[key] = a.mathnum(val)(units)
}
exports.parse = (config, units) => {
// config sanitization
a.unexpected(config, 'points', ['units', 'zones', 'key', 'rotate', 'mirror'])
@ -317,7 +306,7 @@ exports.parse = (config = {}) => {
}
// done
return [filtered, units]
return filtered
}
exports.visualize = (points) => {