You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
465 B
JavaScript

'use strict';
module.exports = function generateItemStyle(item, options) {
let style = Object.assign({}, options.defaultStyle);
item.tags.forEach((tag) => {
if (tag.type === "class") {
tag.classNames.forEach((className) => {
if (options.classes[className] == null) {
throw new Error(`Encountered unrecognized class ${className} in text`);
} else {
Object.assign(style, options.classes[className]);
}
});
}
});
return style;
}