Defer to built-in typeof if built-in support for symbols exists.
This commit is contained in:
parent
570b50c895
commit
d9bf5da460
@ -4,9 +4,9 @@ let helpers = {};
|
||||
export default helpers;
|
||||
|
||||
helpers.typeof = template(`
|
||||
(function (obj) {
|
||||
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
||||
});
|
||||
(typeof Symbol === "function" && typeof Symbol.iterator === "symbol")
|
||||
? function (obj) { return typeof obj; }
|
||||
: function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
||||
`);
|
||||
|
||||
helpers.jsx = template(`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user