mirror of
https://github.com/github/semantic.git
synced 2024-11-25 11:04:00 +03:00
Diff.map.
This commit is contained in:
parent
eb598effa5
commit
57fb7dda4c
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user