ensureArray
If the given value is not an array already, it wraps the value in an array.
Import
import { ensureArray } from '@fullstacksjs/toolbox';
Signature
function ensureArray<T>(value: T): EnsureArray<T> {}
Examples
ensureArray(null); // [null]
ensureArray(undefined); // [undefined]
ensureArray('string'); // ['string']
ensureArray(['array']); // ['array']
ensureArray([1, 2, 3]); // [1, 2, 3]
ensureArray({ foo: 'bar' }); // [{ foo: 'bar' }]