Files
WorkManager/node_modules/ensure-array/ensure-array.js
2024-12-13 08:53:01 +01:00

9 lines
447 B
JavaScript

module.exports = function ensureArray(a, b, n) {
if (arguments.length === 0) return []; // no args, ret []
if (arguments.length === 1) { // single argument
if (a === undefined || a === null) return []; // undefined or null, ret []
if (Array.isArray(a)) return a; // isArray, return it
}
return Array.prototype.slice.call(arguments); // return array with copy of all arguments
}