ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
15 lines (14 loc) • 735 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var doManipulation_1 = require("./doManipulation");
var nodeHandlers_1 = require("./../nodeHandlers");
var textManipulators_1 = require("./../textManipulators");
/**
* Changes the child older of two nodes within a parent.
* @param opts - Options.
*/
function changeChildOrder(opts) {
var parent = opts.parent, getSiblingFormatting = opts.getSiblingFormatting, oldIndex = opts.oldIndex, newIndex = opts.newIndex;
doManipulation_1.doManipulation(parent.sourceFile, new textManipulators_1.ChangingChildOrderTextManipulator(opts), new nodeHandlers_1.NodeHandlerFactory().getForChangingChildOrder(opts));
}
exports.changeChildOrder = changeChildOrder;