refakts
Version:
TypeScript refactoring tool built for AI coding agents to perform precise refactoring operations via command line instead of requiring complete code regeneration.
26 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectionStrategyFactory = void 0;
const range_selection_strategy_1 = require("./range-selection-strategy");
const structural_selection_strategy_1 = require("./structural-selection-strategy");
const boundary_selection_strategy_1 = require("./boundary-selection-strategy");
const regex_selection_strategy_1 = require("./regex-selection-strategy");
class SelectionStrategyFactory {
constructor() {
this.strategies = [
new range_selection_strategy_1.RangeSelectionStrategy(),
new structural_selection_strategy_1.StructuralSelectionStrategy(),
new boundary_selection_strategy_1.BoundarySelectionStrategy(),
new regex_selection_strategy_1.RegexSelectionStrategy()
];
}
getStrategy(options) {
const strategy = this.strategies.find(s => s.canHandle(options));
if (!strategy) {
throw new Error('No suitable selection strategy found for the given options');
}
return strategy;
}
}
exports.SelectionStrategyFactory = SelectionStrategyFactory;
//# sourceMappingURL=selection-strategy-factory.js.map