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 = bindifyDecorators;
  10.  
  11. var _babelTypes = require("babel-types");
  12.  
  13. var t = _interopRequireWildcard(_babelTypes);
  14.  
  15. 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; } }
  16.  
  17. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18.  
  19. function bindifyDecorators(decorators) {
  20.   for (var _iterator = decorators, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  21.     var _ref;
  22.  
  23.     if (_isArray) {
  24.       if (_i >= _iterator.length) break;
  25.       _ref = _iterator[_i++];
  26.     } else {
  27.       _i = _iterator.next();
  28.       if (_i.done) break;
  29.       _ref = _i.value;
  30.     }
  31.  
  32.     var decoratorPath = _ref;
  33.  
  34.     var decorator = decoratorPath.node;
  35.     var expression = decorator.expression;
  36.     if (!t.isMemberExpression(expression)) continue;
  37.  
  38.     var temp = decoratorPath.scope.maybeGenerateMemoised(expression.object);
  39.     var ref = void 0;
  40.  
  41.     var nodes = [];
  42.  
  43.     if (temp) {
  44.       ref = temp;
  45.       nodes.push(t.assignmentExpression("=", temp, expression.object));
  46.     } else {
  47.       ref = expression.object;
  48.     }
  49.  
  50.     nodes.push(t.callExpression(t.memberExpression(t.memberExpression(ref, expression.property, expression.computed), t.identifier("bind")), [ref]));
  51.  
  52.     if (nodes.length === 1) {
  53.       decorator.expression = nodes[0];
  54.     } else {
  55.       decorator.expression = t.sequenceExpression(nodes);
  56.     }
  57.   }
  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