From 6255511de328ae3b5b0f31b878174fdb8a833607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E7=94=9F?= Date: Fri, 10 Dec 2021 10:13:16 +0800 Subject: [PATCH] Fix when colWidths option is undefined, it cause an error --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index c8d1790..561985d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -89,7 +89,7 @@ Table.prototype.toString = function (){ , head = options.head , chars = options.chars , truncater = options.truncate - , colWidths = options.colWidths || new Array(this.head.length) + , colWidths = options.colWidths || new Array(head.length) , totalWidth = 0; if (!head.length && !this.length) return '';