@babel/plugin-transform-typeof-symbol

Example

In

  1. typeof Symbol() === "symbol";

Out

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

Installation

  1. npm install --save-dev @babel/plugin-transform-typeof-symbol

Usage

.babelrc

  1. {
  2. "plugins": ["@babel/plugin-transform-typeof-symbol"]
  3. }

Via CLI

  1. babel --plugins @babel/plugin-transform-typeof-symbol script.js

Via Node API

  1. require("@babel/core").transform("code", {
  2. plugins: ["@babel/plugin-transform-typeof-symbol"]
  3. });