Commit eca28cc1 by Edgar HIPP

Update checks == null

parent ca42a850
...@@ -31,7 +31,7 @@ module.exports = class ImgManager { ...@@ -31,7 +31,7 @@ module.exports = class ImgManager {
} }
loadImageRels() { loadImageRels() {
const file = this.zip.files[`word/_rels/${this.endFileName}.xml.rels`] || this.zip.files["word/_rels/document.xml.rels"]; const file = this.zip.files[`word/_rels/${this.endFileName}.xml.rels`] || this.zip.files["word/_rels/document.xml.rels"];
if (file === undefined) { return; } if (file == null) { return; }
const content = DocUtils.decodeUtf8(file.asText()); const content = DocUtils.decodeUtf8(file.asText());
this.xmlDoc = DocUtils.str2xml(content); this.xmlDoc = DocUtils.str2xml(content);
// Get all Rids // Get all Rids
......
...@@ -71,10 +71,10 @@ module.exports = class ImgReplacer { ...@@ -71,10 +71,10 @@ module.exports = class ImgReplacer {
return; return;
} }
const tagrId = xmlImg.getElementsByTagName("a:blip")[0]; const tagrId = xmlImg.getElementsByTagName("a:blip")[0];
if (tagrId === undefined) { throw new Error("tagRiD undefined !"); } if (tagrId == null) { throw new Error("tagRiD undefined !"); }
const rId = tagrId.getAttribute("r:embed"); const rId = tagrId.getAttribute("r:embed");
const tag = xmlImg.getElementsByTagName("wp:docPr")[0]; const tag = xmlImg.getElementsByTagName("wp:docPr")[0];
if (tag === undefined) { throw new Error("tag undefined"); } if (tag == null) { throw new Error("tag undefined"); }
// if image is already a replacement then do nothing // if image is already a replacement then do nothing
if (tag.getAttribute("name").substr(0, 6) === "Copie_") { return; } if (tag.getAttribute("name").substr(0, 6) === "Copie_") { return; }
const imgName = this.imgManager.getImageName(); const imgName = this.imgManager.getImageName();
...@@ -86,7 +86,7 @@ module.exports = class ImgReplacer { ...@@ -86,7 +86,7 @@ module.exports = class ImgReplacer {
tag.setAttribute("name", `${imgName}`); tag.setAttribute("name", `${imgName}`);
tagrId.setAttribute("r:embed", `rId${newId}`); tagrId.setAttribute("r:embed", `rId${newId}`);
const imageTag = xmlImg.getElementsByTagName("w:drawing")[0]; const imageTag = xmlImg.getElementsByTagName("w:drawing")[0];
if (imageTag === undefined) { throw new Error("imageTag undefined"); } if (imageTag == null) { throw new Error("imageTag undefined"); }
const replacement = DocUtils.xml2Str(imageTag); const replacement = DocUtils.xml2Str(imageTag);
this.xmlTemplater.content = this.xmlTemplater.content.replace(match[0], replacement); this.xmlTemplater.content = this.xmlTemplater.content.replace(match[0], replacement);
......
...@@ -7,9 +7,9 @@ const ImgReplacer = require("./imgReplacer"); ...@@ -7,9 +7,9 @@ const ImgReplacer = require("./imgReplacer");
class ImageModule { class ImageModule {
constructor(options) { constructor(options) {
this.options = options || {}; this.options = options || {};
if (!(this.options.centered != null)) { this.options.centered = false; } if (this.options.centered == null) { this.options.centered = false; }
if (!(this.options.getImage != null)) { throw new Error("You should pass getImage"); } if (this.options.getImage == null) { throw new Error("You should pass getImage"); }
if (!(this.options.getSize != null)) { throw new Error("You should pass getSize"); } if (this.options.getSize == null) { throw new Error("You should pass getSize"); }
this.qrQueue = []; this.qrQueue = [];
this.imageNumber = 1; this.imageNumber = 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment