jsdiff
jsdiff copied to clipboard
Feature Request: Apply to a change to a String
Maybe I'm not seeing it in the docs, but I think it would be nice to apply a Change Object, or an array of them, to a string to be able to create a changed string.
+1 for this feature
Makes sense, but figuring out how to adapt the logic in applyPatch is not entirely trivial. That logic assumes that the changes are a series of hunks with line numbers and local context (rather than literally the entire file content being included in the diff like it is with change objects) and that each change is to an entire line; these things aren't reliably true for change objects.