nvf/lib/lists.nix
NotAShelf 56e20dd9c8
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Treewide Checks / Validate flake (push) Waiting to run
Treewide Checks / Check formatting (push) Waiting to run
Treewide Checks / Check source tree for typos (push) Waiting to run
Treewide Checks / Validate documentation builds (push) Waiting to run
Treewide Checks / Validate documentation builds-1 (push) Waiting to run
Treewide Checks / Validate documentation builds-2 (push) Waiting to run
Treewide Checks / Validate documentation builds-3 (push) Waiting to run
Treewide Checks / Validate hyperlinks in documentation sources (push) Waiting to run
Treewide Checks / Validate Editorconfig conformance (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
lib: format nixdoc values
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ia6dcbf5c44ff6d29e5760111179341226a6a6964
2026-06-20 02:10:57 +03:00

35 lines
609 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;
}