From 0c852a1795c0f5886c5bf5e8fa20e76456e78222 Mon Sep 17 00:00:00 2001 From: ohbarye Date: Sat, 12 May 2018 02:26:28 +0900 Subject: console: .table fall back to logging for function too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the console.table documentation, it reads that it "falls back to just logging the argument if it can’t be parsed as tabular." But it doesn't fall back when I give a function as its first argument. It logs an empty table. This is fixes by this commit. PR-URL: https://github.com/nodejs/node/pull/20681 Fixes: https://github.com/nodejs/node/issues/20679 Reviewed-By: Ruben Bridgewater Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- lib/console.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/console.js') diff --git a/lib/console.js b/lib/console.js index 868b2f286b..de2d11afe1 100644 --- a/lib/console.js +++ b/lib/console.js @@ -327,8 +327,7 @@ Console.prototype.table = function(tabularData, properties) { if (properties !== undefined && !ArrayIsArray(properties)) throw new ERR_INVALID_ARG_TYPE('properties', 'Array', properties); - if (tabularData == null || - (typeof tabularData !== 'object' && typeof tabularData !== 'function')) + if (tabularData == null || typeof tabularData !== 'object') return this.log(tabularData); if (cliTable === undefined) cliTable = require('internal/cli_table'); -- cgit v1.2.3