function toArray(x) {
    if (x == null) {
        return []
    }
    return Array.isArray(x) ? x : [x]
}
Converts a given value to an array.

@param {string|string[]|null|undefined} x - A value to convert.
@returns {string[]} An array.