getPropertyFromItem
Commons
stable
Extracts a value from a data item using a flexible TSelectItemKey accessor — a string path, an array path, a boolean identity flag, or a custom extractor function — with a fallback for missing values.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- itemrequisany
- The data item (object, primitive, or array) to extract a value from.
- propertyrequisTSelectItemKey
- The key accessor. true = return the item itself; string = dot-path; string[] = nested path; function = custom extractor. null, undefined, or false returns the fallback.
- fallbackany
- Value returned when the property cannot be resolved. Defaults to undefined.
API
Valeur de retour
La valeur retournée par cet util.
- The extracted value, the item itself (when property is true), or the fallback.
Usage
Exemples
Extraits de code prêts à coller.
Extract label and value from a select item