Defer to built-in typeof if built-in support for symbols exists.

This commit is contained in:
John-David Dalton 2015-12-27 19:16:55 -06:00
parent 570b50c895
commit d9bf5da460

View File

@ -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(`