From cdffb5057cea0c8a5cb7faeeb841627e7824b02c Mon Sep 17 00:00:00 2001 From: Adem <54160817+phibersoft@users.noreply.github.com> Date: Thu, 23 Jul 2020 01:37:19 +0300 Subject: [PATCH] Update alignment.js Even in a very simple code, these parts fail. It is also very misleading to throw an error about the "justifyLastLine" object for all processes. Please remove these sections, "justifyLastLine" is defined and throws error even if its type is boolean. Code ``` wb.createStyle({ alignment: { horizontal: "center" }}); ``` Output : TypeError : justifyLastLine aligment option must be of type boolean --- source/lib/style/classes/alignment.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/source/lib/style/classes/alignment.js b/source/lib/style/classes/alignment.js index b85205f2..aa8c9324 100644 --- a/source/lib/style/classes/alignment.js +++ b/source/lib/style/classes/alignment.js @@ -41,8 +41,6 @@ class Alignment { // §18.8.1 alignment (Alignment) if (opts.justifyLastLine !== undefined) { if (typeof opts.justifyLastLine === 'boolean') { this.justifyLastLine = opts.justifyLastLine; - } else { - throw new TypeError('justifyLastLine alignment option must be of type boolean'); } } @@ -57,8 +55,6 @@ class Alignment { // §18.8.1 alignment (Alignment) if (opts.shrinkToFit !== undefined) { if (typeof opts.shrinkToFit === 'boolean') { this.shrinkToFit = opts.shrinkToFit; - } else { - throw new TypeError('justifyLastLine alignment option must be of type boolean'); } } @@ -73,9 +69,7 @@ class Alignment { // §18.8.1 alignment (Alignment) if (opts.wrapText !== undefined) { if (typeof opts.wrapText === 'boolean') { this.wrapText = opts.wrapText; - } else { - throw new TypeError('justifyLastLine alignment option must be of type boolean'); - } + } } } @@ -120,4 +114,4 @@ class Alignment { // §18.8.1 alignment (Alignment) } } -module.exports = Alignment; \ No newline at end of file +module.exports = Alignment;