From f9fdcc1bd2a4cfb2c3da3308176231492fc54d57 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 20 Aug 2014 10:43:03 +0100 Subject: Extract stripUtf8Bom function for clarity --- lib/docx/office-xml-reader.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') 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, ''); +} -- cgit v1.2.3