1
1
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:
Rob Rix 2015-10-23 17:19:07 -04:00
parent c5c9e8838b
commit aef4e18518

View File

@ -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);