BVB Source Codes

reactide Show block-hoist.js Source code

Return Download reactide: download block-hoist.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4.  
  5. var _plugin = require("../plugin");
  6.  
  7. var _plugin2 = _interopRequireDefault(_plugin);
  8.  
  9. var _sortBy = require("lodash/sortBy");
  10.  
  11. var _sortBy2 = _interopRequireDefault(_sortBy);
  12.  
  13. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14.  
  15. exports.default = new _plugin2.default({
  16.  
  17.   name: "internal.blockHoist",
  18.  
  19.   visitor: {
  20.     Block: {
  21.       exit: function exit(_ref) {
  22.         var node = _ref.node;
  23.  
  24.         var hasChange = false;
  25.         for (var i = 0; i < node.body.length; i++) {
  26.           var bodyNode = node.body[i];
  27.           if (bodyNode && bodyNode._blockHoist != null) {
  28.             hasChange = true;
  29.             break;
  30.           }
  31.         }
  32.         if (!hasChange) return;
  33.  
  34.         node.body = (0, _sortBy2.default)(node.body, function (bodyNode) {
  35.           var priority = bodyNode && bodyNode._blockHoist;
  36.           if (priority == null) priority = 1;
  37.           if (priority === true) priority = 2;
  38.  
  39.           return -1 * priority;
  40.         });
  41.       }
  42.     }
  43.   }
  44. });
  45. module.exports = exports["default"];
downloadblock-hoist.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