string-differ
Version:
A Javascript library to compare and transform strings.
16 lines • 531 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromRangeOperations = void 0;
const fromRangeOperations = (operations, baseString) => {
return operations.reduce((acc, op) => {
if (op.type === "insert") {
acc += op.value;
}
else if (op.type === "retain") {
acc += baseString.slice(op.startIndex, op.endIndex + 1);
}
return acc;
}, "");
};
exports.fromRangeOperations = fromRangeOperations;
//# sourceMappingURL=range.js.map