diff options
author | Johann-S <johann.servoire@gmail.com> | 2020-03-21 00:33:23 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-03-31 21:11:29 +0300 |
commit | dabd458b4b817136e2a34c97d40e8854c344bf69 (patch) | |
tree | 675d460ce2690f127325d21905bbe749d82e62f2 /js/src/util.js | |
parent | 0c8d8a48e143206452a3cb3ee2d8cf1e49488dbb (diff) |
Backport (#30383)
fix: ensure totype always return stringified null when null passed
Diffstat (limited to 'js/src/util.js')
-rw-r--r-- | js/src/util.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/js/src/util.js b/js/src/util.js index d130682e35..95186bb662 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() } |