distinct¶
Hook for getting distinct items from a list.
Inputs¶
Name | Type | Default | Required | Description |
---|---|---|---|---|
src | Union[list, str] | True | A list to get the distinct values from or a str with separators or list for a key path to the element to rewrite the distinct items back to the context. | |
src_is_key_path | bool | False | True | If the src is a list and is meant to be a key path. |
sep | str | / | True | For string src's, a separator for key path. |
Arguments¶
Position | Argument | Type |
---|---|---|
1 | src | Union[list, str] |
Returns¶
Optional[list]
Examples¶
Distinct values of list passed into src
field.
list:
- stuff
- stuff
- things
compact->: distinct {{list}}
expanded:
->: distinct
src:
- stuff
- stuff
- things
list:
- stuff
- stuff
- things
compact:
- stuff
- things
expanded:
- stuff
- things
Distinct values operating on context
a:
list:
- stuff
- stuff
- things
compact_>: distinct a/list # string inputs interpreted path to key
# Also notice how hook is private as the output is useless
a:
list:
- stuff
- things