tasks/lib/extractor.js
function toJS(node, options, context) {
    switch (node.type) {
        // process numeric values and units
        case 'Dimension':
            var value = node.value;
            var unit = options.units ? node.unit.toCSS(context) : null;

            // if given a list of units to preserve, check if compiled unit is present in that list
            if (Array.isArray(options.units)) unit = options.units.includes(unit) && unit;

            // if we should keep the units, compile the entire node to perform necessary checks,
            // otherwise just return the node value
            return unit ? node.toCSS(context) : value;

        // drop quotes from quoted values
        case 'Quoted':
            return node.value;

        // recursively transform expressions into arrays
        case 'Expression':
            return node.value.map(function (child) {
                return toJS(child, options, context);
            });
    }

    return node.toCSS(context);
}
function toJS(node, options, context) {
    switch (node.type) {
        // process numeric values and units
        case 'Dimension':
            var value = node.value;
            var unit = options.units ? node.unit.toCSS(context) : null;

            // if given a list of units to preserve, check if compiled unit is present in that list
            if (Array.isArray(options.units)) unit = options.units.includes(unit) && unit;

            // if we should keep the units, compile the entire node to perform necessary checks,
            // otherwise just return the node value
            return unit ? node.toCSS(context) : value;

        // drop quotes from quoted values
        case 'Quoted':
            return node.value;

        // recursively transform expressions into arrays
        case 'Expression':
            return node.value.map(function (child) {
                return toJS(child, options, context);
            });
    }

    return node.toCSS(context);
}
function toJS ( node , options , context ) { switch ( node . type ) { // process numeric values and units case 'Dimension' : var value = node . value ; var unit = options . units ? node . unit . toCSS ( context ) : null ; // if given a list of units to preserve, check if compiled unit is present in that list if ( Array . isArray ( options . units ) ) unit = options . units . includes ( unit ) && unit ; // if we should keep the units, compile the entire node to perform necessary checks, // otherwise just return the node value return unit ? node . toCSS ( context ) : value ; // drop quotes from quoted values case 'Quoted' : return node . value ; // recursively transform expressions into arrays case 'Expression' : return node . value . map ( function ( child ) { return toJS ( child , options , context ) ; } ) ; } return node . toCSS ( context ) ; }
modify how value nodes are coerced into JS values, if different from CSS
modify how value nodes are coerced into JS values if different from CSS