vlad 6f123ff03e 18.07 | 6 years ago | |
---|---|---|
.. | ||
lib | 6 years ago | |
.npmignore | 6 years ago | |
README.md | 6 years ago | |
package.json | 6 years ago |
ES6 introduces a new native type called symbols. This transformer wraps all
typeof
expressions with a method that replicates native behaviour. (ie. returning "symbol" for symbols)
In
typeof Symbol() === "symbol";
Out
var _typeof = function (obj) {
return obj && obj.constructor === Symbol ? "symbol" : typeof obj;
};
_typeof(Symbol()) === "symbol";
npm install --save-dev babel-plugin-transform-es2015-typeof-symbol
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-es2015-typeof-symbol"]
}
babel --plugins transform-es2015-typeof-symbol script.js
require("babel-core").transform("code", {
plugins: ["transform-es2015-typeof-symbol"]
});