Created
October 31, 2021 12:54
-
-
Save jjo/db3fb25330dde66e6c8e848e8fdc107e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat > foo.jsonnet | |
local applyModifications(obj, f) = | |
obj + { | |
[x] : f(obj[x]) for x in std.objectFieldsAll(obj) | |
} | |
; | |
applyModifications({ | |
visible: "foo", | |
hidden:: "bar", | |
}, function(x) x + " modified") | |
$ jsonnet foo.jsonnet | |
{ | |
"hidden": "bar modified", | |
"visible": "foo modified" | |
} | |
$ jsonnet --version | |
Jsonnet commandline interpreter v0.17.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment