Nondeterministic Polynomial Munchies

    babel-plugin-transform-es2015-typeof-symbol

    6.23.0 • Public • Published

    babel-plugin-transform-es2015-typeof-symbol

    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)

    Example

    In

    typeof Symbol() === "symbol";

    Out

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

    Installation

    npm install --save-dev babel-plugin-transform-es2015-typeof-symbol

    Usage

    Via .babelrc (Recommended)

    .babelrc

    {
      "plugins": ["transform-es2015-typeof-symbol"]
    }

    Via CLI

    babel --plugins transform-es2015-typeof-symbol script.js

    Via Node API

    require("babel-core").transform("code", {
      plugins: ["transform-es2015-typeof-symbol"]
    });

    Keywords

    Install

    npm i babel-plugin-transform-es2015-typeof-symbol

    DownloadsWeekly Downloads

    1,823,541

    Version

    6.23.0

    License

    MIT

    Last publish

    Collaborators

    • hzoo
    • loganfsmyth
    • existentialism