Sha256: 808f4c37b4c0937d45c61b822bc3c516bd54e1dabad3136f99182e627fdbf547

Contents?: true

Size: 1.35 KB

Versions: 31

Compression:

Stored size: 1.35 KB

Contents

/* */ 
"format cjs";
"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

31 entries across 31 versions & 1 rubygems

Version Path
sequenceserver-3.1.3 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-3.1.2 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-3.1.1 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-3.1.0 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-3.0.1 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-3.0 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.2.0 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.1.0 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc8 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc7 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc6 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc5 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc4 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc3 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc2 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.rc1 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.beta4 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.beta3 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js
sequenceserver-2.0.0.beta1 public/vendor/npm/babel-core@5.8.23/lib/transformation/transformers/internal/block-hoist.js