typedash
Version:
modern, type-safe collection of utility functions
27 lines (25 loc) • 745 B
JavaScript
const require_castArrayIfDefined = require('./castArrayIfDefined-Bwu_WmW3.cjs');
//#region src/functions/castArray/castArray.ts
/**
* Implementation for all overloads.
* @param value The input value to cast to an array.
* @returns An array containing the input value, or the input value itself if it is already an array.
* @example
* ```ts
* castArray('foo'); // ['foo']
* castArray(['foo']); // ['foo']
* castArray(null); // []
* castArray(undefined); // []
* ```
*/
function castArray(value) {
return require_castArrayIfDefined.castArrayIfDefined(value ?? []);
}
//#endregion
Object.defineProperty(exports, 'castArray', {
enumerable: true,
get: function () {
return castArray;
}
});
//# sourceMappingURL=castArray-q6e5dBzI.cjs.map