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 (path, emit) {
  10.   var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "var";
  11.  
  12.   path.traverse(visitor, { kind: kind, emit: emit });
  13. };
  14.  
  15. var _babelTypes = require("babel-types");
  16.  
  17. var t = _interopRequireWildcard(_babelTypes);
  18.  
  19. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  20.  
  21. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  22.  
  23. var visitor = {
  24.   Scope: function Scope(path, state) {
  25.     if (state.kind === "let") path.skip();
  26.   },
  27.   Function: function Function(path) {
  28.     path.skip();
  29.   },
  30.   VariableDeclaration: function VariableDeclaration(path, state) {
  31.     if (state.kind && path.node.kind !== state.kind) return;
  32.  
  33.     var nodes = [];
  34.  
  35.     var declarations = path.get("declarations");
  36.     var firstId = void 0;
  37.  
  38.     for (var _iterator = declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  39.       var _ref;
  40.  
  41.       if (_isArray) {
  42.         if (_i >= _iterator.length) break;
  43.         _ref = _iterator[_i++];
  44.       } else {
  45.         _i = _iterator.next();
  46.         if (_i.done) break;
  47.         _ref = _i.value;
  48.       }
  49.  
  50.       var declar = _ref;
  51.  
  52.       firstId = declar.node.id;
  53.  
  54.       if (declar.node.init) {
  55.         nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.node.id, declar.node.init)));
  56.       }
  57.  
  58.       for (var name in declar.getBindingIdentifiers()) {
  59.         state.emit(t.identifier(name), name);
  60.       }
  61.     }
  62.  
  63.     if (path.parentPath.isFor({ left: path.node })) {
  64.       path.replaceWith(firstId);
  65.     } else {
  66.       path.replaceWithMultiple(nodes);
  67.     }
  68.   }
  69. };
  70.  
  71. 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