Skip to content

Commit

Permalink
Extract stripUtf8Bom function for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilliamson committed Aug 20, 2014
1 parent 8a2bc67 commit f9fdcc1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/docx/office-xml-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '');
}

0 comments on commit f9fdcc1

Please sign in to comment.