1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 02:58:36 +03:00

Diff.map.

This commit is contained in:
Rob Rix 2015-10-23 18:59:24 -04:00
parent eb598effa5
commit 57fb7dda4c

View File

@ -165,6 +165,19 @@
if (object.roll != null) { this.roll = object.roll; }
return this;
}
// forall a b. Diff a -> (a -> b) -> Diff b
Diff.prototype.map = function(transform) {
if (this.pure != null) { return new Diff({ pure: transform(this.pure) }); }
if (this.roll != null) {
return new Diff({
roll: {
extract: roll.extract,
unwrap: roll.unwrap.map(function(x) { return x.map(transform); })
}
});
}
}
</script>
</head>
<body>