epubavocado
Version:
I am an EPUB object model aspiring to be standards compliant.
13 lines (12 loc) • 329 B
JavaScript
export const toArray = (valueOrArray) => {
if (!valueOrArray) {
return [];
}
if (Array.isArray(valueOrArray)) {
return valueOrArray;
}
return [valueOrArray];
};
export const splitRelAttribute = (rel) =>
// normalize spaces and split space separated words
rel.replace(/\s+/g, ' ').split(' ');