mirror of
https://github.com/github/semantic.git
synced 2024-11-25 11:04:00 +03:00
Map over Syntax.
This commit is contained in:
parent
c5c9e8838b
commit
aef4e18518
@ -239,6 +239,13 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
// forall a b. Syntax a -> (a -> b) -> Syntax b
|
||||
Syntax.prototype.map = function(transform) {
|
||||
if (this.indexed != null) { return new Syntax(this.indexed, transform); }
|
||||
if (this.keyed != null) { return new Syntax(this.keyed, transform); }
|
||||
if (this.leaf != null) { return new Syntax(this.leaf, transform); }
|
||||
}
|
||||
|
||||
function Diff(json) {
|
||||
if (json.pure != null) {
|
||||
this.pure = new Patch(json.pure);
|
||||
|
Loading…
Reference in New Issue
Block a user