From 975c13a7cfaf25d811475823824af3a9c04b0ba8 Mon Sep 17 00:00:00 2001 From: xiaofen9 Date: Mon, 30 Dec 2019 09:37:11 -0800 Subject: [PATCH] fix type checking vul in ctorName --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index aa2bb39..bdcfdc8 100644 --- a/index.js +++ b/index.js @@ -66,7 +66,7 @@ module.exports = function kindOf(val) { }; function ctorName(val) { - return val.constructor ? val.constructor.name : null; + return val.constructor && typeof val.constructor === 'function' ? val.constructor.name : null; } function isArray(val) {