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