minor: std
This commit is contained in:
parent
5b32197977
commit
f57e6f47d0
2 changed files with 11 additions and 8 deletions
|
|
@ -93,16 +93,17 @@ in rec {
|
|||
|
||||
mapAttrsRecursive = f: set: mapAttrsRecursiveCond (as: true) f set;
|
||||
|
||||
# form: attrValueAt :: xs -> path -> value
|
||||
# form: attrValueAt :: list string -> set -> Maybe Any
|
||||
# given path as a list of strings, return that value of an
|
||||
# attribute set at that path
|
||||
attrValueAt = let
|
||||
value = foldl (l: r:
|
||||
if builtins.isAttrs l && builtins.hasAttr r l
|
||||
then l.${r}
|
||||
else null);
|
||||
in
|
||||
nullableToMaybe value;
|
||||
attrValueAt = path: xs:
|
||||
foldl (left: right:
|
||||
if builtins.isAttrs left && builtins.hasAttr right left
|
||||
then left.${right}
|
||||
else null)
|
||||
xs
|
||||
path
|
||||
|> nullableToMaybe;
|
||||
|
||||
mergeAttrsList = list: let
|
||||
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`
|
||||
|
|
|
|||
|
|
@ -51,4 +51,6 @@
|
|||
if index == null
|
||||
then default
|
||||
else builtins.elemAt list index;
|
||||
|
||||
zipLists = zipListsWith (fst: snd: {inherit fst snd;});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue