mirror of
https://github.com/TECHNOFAB11/ergogen.git
synced 2025-12-12 16:10:04 +01:00
21 lines
492 B
JavaScript
21 lines
492 B
JavaScript
|
|
const a = require('./assert')
|
||
|
|
const prep = require('./prepare')
|
||
|
|
|
||
|
|
const default_units = {
|
||
|
|
u: 19,
|
||
|
|
cx: 18,
|
||
|
|
cy: 17
|
||
|
|
}
|
||
|
|
|
||
|
|
exports.parse = (config = {}) => {
|
||
|
|
const raw_units = prep.extend(
|
||
|
|
default_units,
|
||
|
|
a.sane(config.units || {}, 'units', 'object')(),
|
||
|
|
a.sane(config.variables || {}, 'variables', 'object')()
|
||
|
|
)
|
||
|
|
const units = {}
|
||
|
|
for (const [key, val] of Object.entries(raw_units)) {
|
||
|
|
units[key] = a.mathnum(val)(units)
|
||
|
|
}
|
||
|
|
return units
|
||
|
|
}
|