all files / blackbird/modules/utils/ parseMediaValues.js

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15             28× 44×        
const parseMediaValue = require("./parseMediaValue");
 
/**
 * Parses a string containing multiple media values and returns an array
 * of objects containing data about each value. Such strings are used as
 * the values of the Accept* family of HTTP headers.
 */
function parseMediaValues(value, typeSeparator) {
    return value.split(/\s*,\s*/).map(function (mediaValue) {
        return parseMediaValue(mediaValue, typeSeparator);
    });
}
 
module.exports = parseMediaValues;