getNestedValue
Commons
stable
Safely drills into a nested object following an array path of string/number keys and returns the value found, or a fallback when any segment is null or the key is absent.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- objrequisany
- The root object or array to traverse.
- pathrequisArray<(string | number)>
- An array of property keys (strings) or array indices (numbers) describing the access path from the root.
- fallbackany
- Value returned when any segment in the path is null, or the final key is absent. Defaults to undefined.
API
Valeur de retour
La valeur retournée par cet util.
- The value at the end of the path, or the fallback if the path cannot be resolved.
Usage
Exemples
Extraits de code prêts à coller.
Read a deeply nested property safely