wrapInArray
Commons
stable
Normalise a value into an array: null/undefined becomes [], an existing array passes through untouched, and any other value is wrapped in a single-element array.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- vrequisT | null | undefined
- The value to normalise. May be a scalar, an array, null, or undefined.
API
Valeur de retour
La valeur retournée par cet util.
- [] for null/undefined, the original array when v is already an array, or [v] for any other value.
Usage
Exemples
Extraits de code prêts à coller.
Scalar, array and null inputs