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 _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6.  
  7. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8.  
  9. exports.default = function (_ref) {
  10.   var t = _ref.types;
  11.  
  12.   function statementList(key, path) {
  13.     var paths = path.get(key);
  14.  
  15.     for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  16.       var _ref2;
  17.  
  18.       if (_isArray) {
  19.         if (_i >= _iterator.length) break;
  20.         _ref2 = _iterator[_i++];
  21.       } else {
  22.         _i = _iterator.next();
  23.         if (_i.done) break;
  24.         _ref2 = _i.value;
  25.       }
  26.  
  27.       var _path = _ref2;
  28.  
  29.       var func = _path.node;
  30.       if (!_path.isFunctionDeclaration()) continue;
  31.  
  32.       var declar = t.variableDeclaration("let", [t.variableDeclarator(func.id, t.toExpression(func))]);
  33.  
  34.       declar._blockHoist = 2;
  35.  
  36.       func.id = null;
  37.  
  38.       _path.replaceWith(declar);
  39.     }
  40.   }
  41.  
  42.   return {
  43.     visitor: {
  44.       BlockStatement: function BlockStatement(path) {
  45.         var node = path.node,
  46.             parent = path.parent;
  47.  
  48.         if (t.isFunction(parent, { body: node }) || t.isExportDeclaration(parent)) {
  49.           return;
  50.         }
  51.  
  52.         statementList("body", path);
  53.       },
  54.       SwitchCase: function SwitchCase(path) {
  55.         statementList("consequent", path);
  56.       }
  57.     }
  58.   };
  59. };
  60.  
  61. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  62.  
  63. 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