es6.spec.symbols

How to use the es6.spec.symbols transformer.

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)

Usage

require("babel").transform("code", { optional: ["es6.spec.symbols"] });
$ babel --optional es6.spec.symbols script.js

Example

In

typeof Symbol() === "symbol";

Out

var _typeof = function (obj) {
  return obj && obj.constructor === Symbol ? "symbol" : typeof obj;
};

_typeof(Symbol()) === "symbol";