lib/quantity.js
function createUnits(conversions, withNames=false) {
    const result = {};
    conversions.forEach(c => c.names.forEach(name =>
        result[unitToLower(normalizeUnitName(name))] = {
            name: c.names[0],

            prefix: c.prefix,

            scale: c.scale,
            toBase: c.toBase,
            fromBase: c.fromBase,

            names: withNames ? c.names : null
        }
    ));
    return result;
}
function createUnits(conversions, withNames=false) {
    const result = {};
    conversions.forEach(c => c.names.forEach(name =>
        result[unitToLower(normalizeUnitName(name))] = {
            name: c.names[0],

            prefix: c.prefix,

            scale: c.scale,
            toBase: c.toBase,
            fromBase: c.fromBase,

            names: withNames ? c.names : null
        }
    ));
    return result;
}
function createUnits ( conversions , withNames = false ) { const result = { } ; conversions . forEach ( c => c . names . forEach ( name => result [ unitToLower ( normalizeUnitName ( name ) ) ] = { name : c . names [ 0 ] , prefix : c . prefix , scale : c . scale , toBase : c . toBase , fromBase : c . fromBase , names : withNames ? c . names : null } ) ) ; return result ; }
Map a list of conversions into an object where each name is represented
as a key.
Map a list of conversions into an object where each name is represented as a key .