UNPKG

typedash

Version:

modern, type-safe collection of utility functions

22 lines (20 loc) 758 B
const require_isArray = require('./isArray-CK0opY_i.cjs'); //#region src/functions/castArrayIfDefined/castArrayIfDefined.ts /** * Implementation for all overloads. * @param value The value to convert to an array if it's not already one. * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`. */ function castArrayIfDefined(value) { if (value == null) return value; if (require_isArray.isArray(value)) return value; return [value]; } //#endregion Object.defineProperty(exports, 'castArrayIfDefined', { enumerable: true, get: function () { return castArrayIfDefined; } }); //# sourceMappingURL=castArrayIfDefined-Bwu_WmW3.cjs.map