diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-08-20 10:43:03 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-08-20 10:43:03 +0100 |
| commit | f9fdcc1bd2a4cfb2c3da3308176231492fc54d57 (patch) | |
| tree | e218722af6269044d5b1304e40b620694e756372 | |
| parent | 8a2bc6777c17780d93c2d896f58ba8262aaee768 (diff) | |
Extract stripUtf8Bom function for clarity
| -rw-r--r-- | lib/docx/office-xml-reader.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/docx/office-xml-reader.js b/lib/docx/office-xml-reader.js index 861b11e..b4e21e5 100644 --- a/lib/docx/office-xml-reader.js +++ b/lib/docx/office-xml-reader.js @@ -22,11 +22,14 @@ function read(xmlString) { function readXmlFromZipFile(docxFile, path) { if (docxFile.exists(path)) { return docxFile.read(path, "utf-8") - .then(function (xmlString) { - return xmlString.replace(/^\uFEFF/g, ''); - }) + .then(stripUtf8Bom) .then(read); } else { return promises.resolve(null); } } + + +function stripUtf8Bom(xmlString) { + return xmlString.replace(/^\uFEFF/g, ''); +} |
