BVB Source Codes

reactide Show memoise-decorators.js Source code

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