mirror of
https://github.com/mwilliamson/mammoth.js.git
synced 2024-12-08 15:14:29 +00:00
16 lines
456 B
JavaScript
16 lines
456 B
JavaScript
exports.paragraph = function(transform) {
|
|
function transformElement(element) {
|
|
if (element.children) {
|
|
for (var i = 0; i < element.children.length; i++) {
|
|
element.children[i] = transformElement(element.children[i]);
|
|
}
|
|
}
|
|
if (element.type === "paragraph") {
|
|
return transform(element);
|
|
} else {
|
|
return element;
|
|
}
|
|
}
|
|
return transformElement;
|
|
};
|