overrideAttrs: init
This commit is contained in:
parent
3a6322f7c6
commit
ec3006ab6f
|
@ -14,5 +14,6 @@
|
|||
getAttrs = import ./src/getAttrs.nix lib;
|
||||
subtractLists = import ./src/subtractLists.nix lib;
|
||||
unique = import ./src/unique.nix lib;
|
||||
overrideExisting = import ./src/overrideExisting.nix lib;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
lib:
|
||||
let
|
||||
overrideExistingOld =
|
||||
old:
|
||||
new:
|
||||
builtins.mapAttrs (name: value: new.${name} or value) old;
|
||||
|
||||
overrideExistingNew =
|
||||
old:
|
||||
new:
|
||||
old // (builtins.intersectAttrs old new);
|
||||
|
||||
bigdata = lib.genAttrs (lib.imap0 (i: _: toString i) (lib.replicate 999999 null)) (_: null);
|
||||
attrsToOverride = {
|
||||
"1" = "lmao";
|
||||
"183" = "lmao";
|
||||
"1823" = "lmao";
|
||||
"1223" = "lmao";
|
||||
"ads;fkjasdlfkja" = "no";
|
||||
};
|
||||
in {
|
||||
old = overrideExistingOld bigdata attrsToOverride;
|
||||
new = overrideExistingNew bigdata attrsToOverride;
|
||||
sanity = (overrideExistingOld bigdata attrsToOverride) == (overrideExistingNew bigdata attrsToOverride);
|
||||
}
|
Loading…
Reference in New Issue