Sha256: 5a4467596acb0a9d0ae0f956dbdbe8659aa138efa3c721e46d982bc6e530eb55

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.printUndef = void 0;
const prettier_1 = __importDefault(require("../../prettier"));
const { addTrailingComment, align, group, join, line } = prettier_1.default;
const printUndefSymbol = (path, opts, print) => {
    const node = path.getValue();
    // Since we're going to descend into the symbol literal to grab out the ident
    // node, then we need to make sure we copy over any comments as well,
    // otherwise we could accidentally skip printing them.
    if (node.comments) {
        node.comments.forEach((comment) => {
            addTrailingComment(node.body[0], comment);
        });
    }
    return path.call(print, "body", 0);
};
const printUndef = (path, opts, print) => {
    const keyword = "undef ";
    const argNodes = path.map((symbolPath) => printUndefSymbol(symbolPath, opts, print), "body");
    return group([keyword, align(keyword.length, join([",", line], argNodes))]);
};
exports.printUndef = printUndef;

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
prettier-2.0.0 dist/ruby/nodes/undef.js
prettier-2.0.0.pre.rc4 dist/ruby/nodes/undef.js
prettier-2.0.0.pre.rc3 dist/ruby/nodes/undef.js
prettier-2.0.0.pre.rc2 dist/ruby/nodes/undef.js
prettier-2.0.0.pre.rc1 dist/ruby/nodes/undef.js