Sha256: 8eb069b6ba6f7f958d13b8b8cbd37300b034ba641ff7fa8366296dd6c684d1fa

Contents?: true

Size: 1.29 KB

Versions: 98

Compression:

Stored size: 1.29 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.hooks = void 0;
const hooks = exports.hooks = [function (self, parent) {
  const removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement();
  if (removeParent) {
    parent.remove();
    return true;
  }
}, function (self, parent) {
  if (parent.isSequenceExpression() && parent.node.expressions.length === 1) {
    parent.replaceWith(parent.node.expressions[0]);
    return true;
  }
}, function (self, parent) {
  if (parent.isBinary()) {
    if (self.key === "left") {
      parent.replaceWith(parent.node.right);
    } else {
      parent.replaceWith(parent.node.left);
    }
    return true;
  }
}, function (self, parent) {
  if (parent.isIfStatement() && self.key === "consequent" || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) {
    self.replaceWith({
      type: "BlockStatement",
      body: []
    });
    return true;
  }
}];

//# sourceMappingURL=removal-hooks.js.map

Version data entries

98 entries across 15 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-modules-systemjs/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/helper-skip-transparent-expression-wrappers/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-async-generator-functions/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/helper-wrap-function/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-classes/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/helper-remap-async-to-generator/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/helper-module-imports/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.51 node_modules/@babel/helper-simple-access/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.50 node_modules/@babel/helper-module-imports/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.50 node_modules/@babel/helper-remap-async-to-generator/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.50 node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-object-super/node_modules/@babel/helper-replace-supers/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-function-name/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js