open-vault/ui/app/helpers/reduce-to-array.js
2018-04-03 09:16:57 -05:00

17 lines
373 B
JavaScript

import Ember from 'ember';
export function reduceToArray(params) {
return params.reduce(function(result, param) {
if (Ember.isNone(param)) {
return result;
}
if (Ember.typeOf(param) === 'array') {
return result.concat(param);
} else {
return result.concat([param]);
}
}, []);
}
export default Ember.Helper.helper(reduceToArray);