BVB Source Codes

reactide Show index.js Source code

Return Download reactide: download index.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4.  
  5. var _symbol = require("babel-runtime/core-js/symbol");
  6.  
  7. var _symbol2 = _interopRequireDefault(_symbol);
  8.  
  9. exports.default = function (_ref) {
  10.   var t = _ref.types;
  11.  
  12.   var IGNORE = (0, _symbol2.default)();
  13.  
  14.   return {
  15.     visitor: {
  16.       Scope: function Scope(_ref2) {
  17.         var scope = _ref2.scope;
  18.  
  19.         if (!scope.getBinding("Symbol")) {
  20.           return;
  21.         }
  22.  
  23.         scope.rename("Symbol");
  24.       },
  25.       UnaryExpression: function UnaryExpression(path) {
  26.         var node = path.node,
  27.             parent = path.parent;
  28.  
  29.         if (node[IGNORE]) return;
  30.         if (path.find(function (path) {
  31.           return path.node && !!path.node._generated;
  32.         })) return;
  33.  
  34.         if (path.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) {
  35.           var opposite = path.getOpposite();
  36.           if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") {
  37.             return;
  38.           }
  39.         }
  40.  
  41.         if (node.operator === "typeof") {
  42.           var call = t.callExpression(this.addHelper("typeof"), [node.argument]);
  43.           if (path.get("argument").isIdentifier()) {
  44.             var undefLiteral = t.stringLiteral("undefined");
  45.             var unary = t.unaryExpression("typeof", node.argument);
  46.             unary[IGNORE] = true;
  47.             path.replaceWith(t.conditionalExpression(t.binaryExpression("===", unary, undefLiteral), undefLiteral, call));
  48.           } else {
  49.             path.replaceWith(call);
  50.           }
  51.         }
  52.       }
  53.     }
  54.   };
  55. };
  56.  
  57. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  58.  
  59. module.exports = exports["default"];
downloadindex.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top