mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-23 13:03:25 +00:00
lib: add RFC-145 nixdoc comments to extended library functions
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I41c4b2cb70512699a044578fa88eb8266a6a6964
This commit is contained in:
parent
63d8fc82d6
commit
a17f043605
7 changed files with 506 additions and 19 deletions
|
|
@ -1,5 +1,26 @@
|
|||
{lib}: let
|
||||
inherit (builtins) listToAttrs;
|
||||
in {
|
||||
/**
|
||||
Map over a list and convert the result to an attribute set.
|
||||
|
||||
# Type
|
||||
|
||||
```
|
||||
mapListToAttrs :: (a -> { name :: String; value :: b }) -> [a] -> AttrSet
|
||||
```
|
||||
|
||||
# Arguments
|
||||
|
||||
- `f`: Function mapping each list element to a `{ name; value }` pair.
|
||||
- `list`: The list to map over.
|
||||
|
||||
# Example
|
||||
|
||||
```nix
|
||||
mapListToAttrs (x: { name = x; value = x; }) ["a" "b"]
|
||||
=> { a = "a"; b = "b"; }
|
||||
```
|
||||
*/
|
||||
mapListToAttrs = f: list: listToAttrs (map f list);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue