convert_map_keys_to_files
Iteratively search a map
for matching keys which are converted to file
types. Single values (string
) are converted, or all elements in a collection
, or all values of a map
.
Arguments
Name | Description | Type |
---|---|---|
x | A potentially nested map that contains key/value pairs that can be identified using keys and modified to file type. | map |
keys | Collection of strings that are keys in x . The string(s) in these keys are converted using file() . | strings |
Output value
Keys ofx
are modified and the new map
returned.Example
x = [first: 'sherlock', second: 'john', nemeses: ['james', 'lestrade']]
// { "first": "sherlock",
// "second": "john",
// "nemeses": ["james", "lestrade"] }
convert_map_keys_to_files(x, 'first')
// { "first": "/path/to/sherlock",
// "second": "john",
// "nemeses": ["james", "lestrade"] }
convert_map_keys_to_files(x, ['first', 'nemeses'])
// { "first": "/path/to/sherlock",
// "second": "john",
// "nemeses": ["/path/to/james", "/path/to/lestrade"] }