esformatter
Version:
ECMAScript code beautifier/formatter
14 lines (11 loc) • 401 B
JavaScript
;
exports.shouldIndentChild = shouldIndentChild;
function shouldIndentChild(parent, child, opts) {
// this will avoid indenting objects/arrays/functions twice if they
// are on the right of a BinaryExpression, LogicalExpression or
// UnaryExpression
if (!child || !opts[parent.type + '.' + child.type]) {
return false;
}
return !child.right || !opts[child.right.type];
}