Sha256: daa501a994c8fe0b32dec005f13d0d22d1420e18e599521e2db425ce5e94f922

Contents?: true

Size: 958 Bytes

Versions: 7

Compression:

Stored size: 958 Bytes

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _helperPluginUtils = require("@babel/helper-plugin-utils");

var _helperFunctionName = require("@babel/helper-function-name");

var _default = (0, _helperPluginUtils.declare)(api => {
  api.assertVersion(7);
  return {
    name: "transform-function-name",
    visitor: {
      FunctionExpression: {
        exit(path) {
          if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
            const replacement = (0, _helperFunctionName.default)(path);
            if (replacement) path.replaceWith(replacement);
          }
        }

      },

      ObjectProperty(path) {
        const value = path.get("value");

        if (value.isFunction()) {
          const newNode = (0, _helperFunctionName.default)(value);
          if (newNode) value.replaceWith(newNode);
        }
      }

    }
  };
});

exports.default = _default;

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.16.1 test/dummy/node_modules/@babel/plugin-transform-function-name/lib/index.js
disco_app-0.15.2 test/dummy/node_modules/@babel/plugin-transform-function-name/lib/index.js
disco_app-0.18.4 test/dummy/node_modules/@babel/plugin-transform-function-name/lib/index.js
disco_app-0.18.1 test/dummy/node_modules/@babel/plugin-transform-function-name/lib/index.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@babel/plugin-transform-function-name/lib/index.js
disco_app-0.14.0 test/dummy/node_modules/@babel/plugin-transform-function-name/lib/index.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@babel/plugin-transform-function-name/lib/index.js