Table: allow omitting prop if sort-method is provided

pull/5397/merge
Leopoldthecoder 2017-08-08 17:38:00 +08:00 committed by 杨奕
parent aae78193f9
commit 0966662dc0
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ export const orderBy = function(array, sortKey, reverse, sortMethod) {
if (typeof reverse === 'string') { if (typeof reverse === 'string') {
reverse = reverse === 'descending' ? -1 : 1; reverse = reverse === 'descending' ? -1 : 1;
} }
if (!sortKey) { if (!sortKey && !sortMethod) {
return array; return array;
} }
const order = (reverse && reverse < 0) ? -1 : 1; const order = (reverse && reverse < 0) ? -1 : 1;