link-types
Version:
Parse an HTML attribute value containing link types.
26 lines (20 loc) • 516 B
JavaScript
;
var linkTypes = function linkTypes(attrValue) {
return split(attrValue).filter(function (type) {
return type !== "";
});
};
var map = function map(attrValue) {
return split(attrValue).reduce(function (result, type) {
if (type !== "") {
result[type] = true;
}
return result;
}, {});
};
var split = function split(attrValue) {
return attrValue.trim().toLowerCase().split(" ");
};
linkTypes.map = map;
module.exports = linkTypes;
//# sourceMappingURL=index-es5.js.map