/**1* Takes any input and guarantees an array back.2*3* - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.4* - Converts `undefined` to an empty array.5* - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.6* - Ignores input which is already an array.7*8* @module array-back9* @example10* > const arrayify = require('array-back')11*12* > arrayify(undefined)13* []14*15* > arrayify(null)16* [ null ]17*18* > arrayify(0)19* [ 0 ]20*21* > arrayify([ 1, 2 ])22* [ 1, 2 ]23*24* > arrayify(new Set([ 1, 2 ]))25* [ 1, 2 ]26*27* > function f(){ return arrayify(arguments); }28* > f(1,2,3)29* [ 1, 2, 3 ]30*/3132function isObject (input) {33return typeof input === 'object' && input !== null34}3536function isArrayLike (input) {37return isObject(input) && typeof input.length === 'number'38}3940/**41* @param {*} - The input value to convert to an array42* @returns {Array}43* @alias module:array-back44*/45function arrayify (input) {46if (Array.isArray(input)) {47return input48}4950if (input === undefined) {51return []52}5354if (isArrayLike(input) || input instanceof Set) {55return Array.from(input)56}5758return [ input ]59}6061export default arrayify626364