Last active
July 22, 2023 00:02
-
-
Save mkmik/1156e8bfa45b9129c592dd4a6a4b04ac 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
local to_overlay = import 'to_overlay.libsonnet'; | |
{ | |
a: { | |
b: { | |
c: 1, | |
d: self.c, | |
h:: 42, | |
}, | |
}, | |
} + to_overlay.toOverlay(std.parseYaml(||| | |
a: | |
b: | |
c: 10 | |
|||)) + { | |
a+: { | |
b+: { | |
answer: self.h, | |
}, | |
}, | |
} |
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
{ | |
toOverlay(v):: local t = std.type(v); if t == 'object' then { | |
[kv.key]+: $.toOverlay(kv.value) | |
for kv in std.objectKeysValues(v) | |
if std.type(kv.value) == 'object' | |
} + { | |
[kv.key]: kv.value | |
for kv in std.objectKeysValues(v) | |
if std.type(kv.value) != 'object' | |
} else v, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment