ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
22 lines (20 loc) • 770 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("./../../utils");
const FormattingKind_1 = require("./FormattingKind");
function getClassMemberFormatting(parent, member) {
if (parent.isAmbient())
return FormattingKind_1.FormattingKind.Newline;
if (hasBody(member))
return FormattingKind_1.FormattingKind.Blankline;
return FormattingKind_1.FormattingKind.Newline;
}
exports.getClassMemberFormatting = getClassMemberFormatting;
function hasBody(node) {
if (utils_1.TypeGuards.isBodyableNode(node) && node.getBody() != null)
return true;
if (utils_1.TypeGuards.isBodiedNode(node))
return true;
return false;
}
//# sourceMappingURL=getClassMemberFormatting.js.map