Tree.

withKeys(tree, keys)

Returns a new tree with the specified keys. This is similar to mask, but here the values (not the keys) will be used from the keys option. Typically keys will be an array of strings.

A use for this is to establish a domain for a function. Given a function that returns a string, withKeys establishes a domain for the function.

// withKeys.ori
Tree.withKeys((name) => `Hello, ${name}!`, ['Alice', 'Bob', 'Charlie'])

Since the function now has a domain, it can be expanded into a full tree.

$ ori withKeys.ori/
Alice: Hello, Alice!
Bob: Hello, Bob!
Charlie: Hello, Charlie!

Here the ori CLI can ask for the keys, and then get the value for each of those keys using the function.