query
On this page

getAttrs

lib.getAttrs

Docs pulled from | This Revision | 13 minutes ago


Given a set of attribute names, return the set of the corresponding attributes from the given set.

Inputs

names

A list of attribute names to get out of set

attrs

The set to get the named attributes from

Type

getAttrs :: [String] -> AttrSet -> AttrSet

Examples

lib.attrsets.getAttrs usage example

getAttrs [ "a" "b" ] { a = 1; b = 2; c = 3; }
=> { a = 1; b = 2; }
(lib.attrsets.getAttrs)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

getAttrs =
    names:
    attrs: genAttrs names (name: attrs.${name});