Skip to content

Feature request: JsDiff.serializePatch(structuredPatch) #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
adius opened this issue Apr 22, 2016 · 3 comments · Fixed by #451
Closed

Feature request: JsDiff.serializePatch(structuredPatch) #109

adius opened this issue Apr 22, 2016 · 3 comments · Fixed by #451

Comments

@adius
Copy link
Contributor

adius commented Apr 22, 2016

What do you think about adding a JsDiff.serializeStructuredPatch(structuredPatchObject) method,
which is basically the reverse of JsDiff.parsePatch(diffStr).

I'd even provide a pull request =P

@kpdecker
Copy link
Owner

Name is a little bit lengthy, but glad to review and PRs sent in.

@RonWang
Copy link

RonWang commented Jun 18, 2018

@kpdecker How do we generate the diffStr out now? Does it come from structuredObject?

@ExplodingCabbage
Copy link
Collaborator

Hmm. It looks to me like the formatPatch method we already export from patch/create.js essentially is the serializePatch method contemplated here, and all I need to do is

  1. add tests showing it's the inverse of parsePatch
  2. expose it on the top-level Diff object exported by the library, and
  3. document it

I would also prefer serializePatch as a name over formatPatch but I suppose it doesn't matter much so I'll just keep the old name for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants