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. exports.default = function (opts) {
  6.   var visitor = {};
  7.  
  8.   function isAssignment(node) {
  9.     return node && node.operator === opts.operator + "=";
  10.   }
  11.  
  12.   function buildAssignment(left, right) {
  13.     return t.assignmentExpression("=", left, right);
  14.   }
  15.  
  16.   visitor.ExpressionStatement = function (path, file) {
  17.     if (path.isCompletionRecord()) return;
  18.  
  19.     var expr = path.node.expression;
  20.     if (!isAssignment(expr)) return;
  21.  
  22.     var nodes = [];
  23.     var exploded = (0, _babelHelperExplodeAssignableExpression2.default)(expr.left, nodes, file, path.scope, true);
  24.  
  25.     nodes.push(t.expressionStatement(buildAssignment(exploded.ref, opts.build(exploded.uid, expr.right))));
  26.  
  27.     path.replaceWithMultiple(nodes);
  28.   };
  29.  
  30.   visitor.AssignmentExpression = function (path, file) {
  31.     var node = path.node,
  32.         scope = path.scope;
  33.  
  34.     if (!isAssignment(node)) return;
  35.  
  36.     var nodes = [];
  37.     var exploded = (0, _babelHelperExplodeAssignableExpression2.default)(node.left, nodes, file, scope);
  38.     nodes.push(buildAssignment(exploded.ref, opts.build(exploded.uid, node.right)));
  39.     path.replaceWithMultiple(nodes);
  40.   };
  41.  
  42.   visitor.BinaryExpression = function (path) {
  43.     var node = path.node;
  44.  
  45.     if (node.operator === opts.operator) {
  46.       path.replaceWith(opts.build(node.left, node.right));
  47.     }
  48.   };
  49.  
  50.   return visitor;
  51. };
  52.  
  53. var _babelHelperExplodeAssignableExpression = require("babel-helper-explode-assignable-expression");
  54.  
  55. var _babelHelperExplodeAssignableExpression2 = _interopRequireDefault(_babelHelperExplodeAssignableExpression);
  56.  
  57. var _babelTypes = require("babel-types");
  58.  
  59. var t = _interopRequireWildcard(_babelTypes);
  60.  
  61. 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; } }
  62.  
  63. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  64.  
  65. 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