diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-04-23 13:08:46 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-04-23 13:08:46 +0100 |
| commit | a3081d89eeccc3410bdf0dd045f8701792bf9154 (patch) | |
| tree | 1d8bf14746ab715b0858207254988f910f33de85 /README.md | |
| parent | 3433c9bfcc62c095d96af81df9a742e98b582715 (diff) | |
Use object spread syntax instead of extend function in examples
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -462,7 +462,7 @@ You can use the `transformDocument` argument to modify the document appropriatel function transformElement(element) { if (element.children) { var children = _.map(element.children, transformElement); - element = extend(element, {children: children}); + element = {...element, children: children}; } if (element.type === "paragraph") { @@ -474,7 +474,7 @@ function transformElement(element) { function transformParagraph(element) { if (element.alignment === "center" && !element.styleId) { - return extend(element, {styleId: "Heading2"}); + return {...element, styleId: "Heading2"}; } else { return element; } @@ -492,7 +492,7 @@ The above can be written more succinctly using the helper `mammoth.transforms.pa ```javascript function transformParagraph(element) { if (element.alignment === "center" && !element.styleId) { - return extend(element, {styleId: "Heading2"}); + return {...element, styleId: "Heading2"}; } else { return element; } |
