Sha256: bc11db99098e4946d463bfe5abd00f2c21f66d09011038d2592de42a37863ac9

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

"use strict";

exports.__esModule = true;
// istanbul ignore next

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var _lodashCollectionSortBy = require("lodash/collection/sortBy");

var _lodashCollectionSortBy2 = _interopRequireDefault(_lodashCollectionSortBy);

var metadata = {
  group: "builtin-trailing"
};

exports.metadata = metadata;
/**
 * [Please add a description.]
 *
 * Priority:
 *
 *  - 0 We want this to be at the **very** bottom
 *  - 1 Default node position
 *  - 2 Priority over normal nodes
 *  - 3 We want this to be at the **very** top
 */

var visitor = {

  /**
   * [Please add a description.]
   */

  Block: {
    exit: function exit(node) {
      var hasChange = false;
      for (var i = 0; i < node.body.length; i++) {
        var bodyNode = node.body[i];
        if (bodyNode && bodyNode._blockHoist != null) {
          hasChange = true;
          break;
        }
      }
      if (!hasChange) return;

      node.body = _lodashCollectionSortBy2["default"](node.body, function (bodyNode) {
        var priority = bodyNode && bodyNode._blockHoist;
        if (priority == null) priority = 1;
        if (priority === true) priority = 2;

        // Higher priorities should move toward the top.
        return -1 * priority;
      });
    }
  }
};
exports.visitor = visitor;

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
ilog-0.4.1 node_modules/babel/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js
ilog-0.4.0 node_modules/babel/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js
ilog-0.3.3 node_modules/babel/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/transformation/transformers/internal/block-hoist.js