query
On this page

overrideExisting

lib.overrideExisting

Docs pulled from | This Revision | 13 minutes ago


Override only the attributes that are already present in the old set useful for deep-overriding.

Inputs

old

Original attribute set

new

Attribute set with attributes to override in old.

Type

overrideExisting :: AttrSet -> AttrSet -> AttrSet

Examples

lib.attrsets.overrideExisting usage example

overrideExisting {} { a = 1; }
=> {}
overrideExisting { b = 2; } { a = 1; }
=> { b = 2; }
overrideExisting { a = 3; b = 2; } { a = 1; }
=> { a = 1; b = 2; }
(lib.attrsets.overrideExisting)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

overrideExisting =
    old:
    new:
    mapAttrs (name: value: new.${name} or value) old;