1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Map over dictionaries.

This commit is contained in:
Rob Rix 2015-10-23 17:19:00 -04:00
parent ff21b7d299
commit c5c9e8838b

View File

@ -223,9 +223,13 @@
return this;
}
function Leaf(object) {
this.value = object;
return this;
// forall a b. Dictionary String a -> (a -> b) -> Dictionary String b
Dictionary.prototype.map = function(transform) {
var copy = new Dictionary();
for (key in this.values) {
copy.values[key] = transform(this.values[key]);
}
return copy;
}
function Syntax(json, continuation) {