UNPKG

arrayify-compact

Version:

Casts the given value to a flatten array, and removes falsey items (similar to lodash compact).

9 lines (6 loc) 180 B
'use strict'; var flatten = require('arr-flatten'); module.exports = function arrayify(val) { val = Array.isArray(val) ? val : [val]; return flatten(val).filter(Boolean); };