mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-22 20:43:27 +00:00
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I41c4b2cb70512699a044578fa88eb8266a6a6964
35 lines
639 B
Nix
35 lines
639 B
Nix
{lib}: let
|
|
inherit (lib.lists) elem all;
|
|
in {
|
|
/**
|
|
Checks if all values are present in the list.
|
|
|
|
# Type
|
|
|
|
```
|
|
listContainsValues :: { list :: [a], values :: [a] } -> Bool
|
|
```
|
|
|
|
# Arguments
|
|
|
|
- `list`: A list of elements.
|
|
- `values`: A list of values to check for presence in the list.
|
|
|
|
# Example
|
|
|
|
```nix
|
|
listContainsValues { list = [1 2 3]; values = [2 3]; }
|
|
=> true
|
|
|
|
listContainsValues { list = [1 2 3]; values = [2 4]; }
|
|
=> false
|
|
```
|
|
*/
|
|
listContainsValues = {
|
|
list,
|
|
values,
|
|
}: let
|
|
containsValue = value: elem value list;
|
|
in
|
|
all containsValue values;
|
|
}
|