UNPKG

string-differ

Version:

A Javascript library to compare and transform strings.

22 lines 953 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getStepsForTransformation = getStepsForTransformation; exports.transformString = transformString; const operations_1 = require("./operations"); const transformation_1 = require("./transformation"); function getStepsForTransformation(type, { s1, s2 }) { if (type !== "Char" && type !== "Range") { throw new Error("Operation type not supported!"); } const store = (0, operations_1.Store)(); const context = { a: s1, b: s2, store }; (0, operations_1.generateEditScript)(context); return (0, operations_1.getOperations)(type, context); } function transformString(operationType, baseString, operations) { if (operationType === "Char") { return (0, transformation_1.fromCharOperations)(operations, baseString); } return (0, transformation_1.fromRangeOperations)(operations, baseString); } //# sourceMappingURL=index.js.map