Assert that path exists on input, optionally checking the value at that path with predicate.
Example
constinput = { a: { b:1 } };
assertPathExists(input, 'a.b'); // does not throw assertPathExists(input, 'a.b', (value): valueisnumber=>typeofvalue === 'number'); // does not throw assertPathExists(input, 'c'); // throws Error: object path (c) does not exist on input
Assert that
pathexists oninput, optionally checking the value at that path withpredicate.Example