From dabd458b4b817136e2a34c97d40e8854c344bf69 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Fri, 20 Mar 2020 22:33:23 +0100 Subject: Backport (#30383) fix: ensure totype always return stringified null when null passed --- js/src/util.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/src') diff --git a/js/src/util.js b/js/src/util.js index d130682e3..95186bb66 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -19,6 +19,10 @@ const MILLISECONDS_MULTIPLIER = 1000 // Shoutout AngusCroll (https://goo.gl/pxwQGp) function toType(obj) { + if (obj === null || typeof obj === 'undefined') { + return `${obj}` + } + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() } -- cgit v1.2.3