mirror of
https://github.com/github/semantic.git
synced 2024-11-25 11:04:00 +03:00
Add a function to construct diffs from JSON.
This commit is contained in:
parent
692ae3be29
commit
20057acaff
@ -155,6 +155,13 @@
|
||||
if (this.leaf != null) { return new Syntax(this, transform); }
|
||||
}
|
||||
|
||||
function diffFromJSON(json) {
|
||||
if (json.pure != null) { return new Diff({ pure: new Patch(json.pure) }); }
|
||||
if (json.roll != null) {
|
||||
return new Diff({ ranges: json.roll.extract, roll: new Syntax(json.roll.unwrap, function(x) { return diffFromJSON(x); }) });
|
||||
}
|
||||
}
|
||||
|
||||
function Diff(json) {
|
||||
if (json.pure != null) {
|
||||
this.pure = new Patch(json.pure);
|
||||
|
Loading…
Reference in New Issue
Block a user