use shortcut for array wrapping

This commit is contained in:
Joe Fleming 2015-06-11 11:12:41 -07:00
parent 9326729174
commit 884ebbd9e7

View file

@ -11,15 +11,10 @@ define(function (require) {
return function (sortObject, indexPattern) {
var normalizedSort = [];
if (_.isArray(sortObject)) {
normalizedSort = _.map(sortObject, function (sortable) {
return normalize(sortable, indexPattern);
});
} else {
normalizedSort.push(normalize(sortObject, indexPattern));
}
return normalizedSort;
// [].concat({}) -> [{}], [].concat([{}]) -> [{}]
return [].concat(sortObject).map(function (sortable) {
return normalize(sortable, indexPattern);
});
};
/*