Safely retrieves a nested value from an object using a path.
The object to query.
The path to the nested property (dot-separated).
Optional
The fallback value if the path doesn't exist.
The value at the nested path or the fallback.
getNested({ a: { b: 2 } }, 'a.b'); // 2getNested({ a: { b: 2 } }, 'a.c', 0); // 0 Copy
getNested({ a: { b: 2 } }, 'a.b'); // 2getNested({ a: { b: 2 } }, 'a.c', 0); // 0
Safely retrieves a nested value from an object using a path.