Sha256: e3bc73ef65c06a91f198ec4204e913d95a96a680c049195c27bea17dbb8e0ff0

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

Contents

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const helper_comments_1 = require("@resugar/helper-comments");
function default_1({ types: t }) {
    return {
        name: '@resugar/codemod-objects-shorthand',
        visitor: {
            ObjectProperty(path) {
                const { node } = path;
                if (node.computed || node.shorthand) {
                    return;
                }
                if (!t.isIdentifier(node.key) || !t.isIdentifier(node.value)) {
                    return;
                }
                if (node.key.name !== node.value.name) {
                    return;
                }
                node.shorthand = true;
                helper_comments_1.copyLeadingComments(node.value, node.key, helper_comments_1.addTrailingComment);
            }
        }
    };
}
exports.default = default_1;
//# sourceMappingURL=index.js.map

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wice_grid-7.1.0 node_modules/@resugar/codemod-objects-shorthand/src/index.js