Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/getCollectionEntries.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ function getEntries(type, collection, sortObjectKeys, from = 0, to = Infinity) {
if (type === 'Object') {
let keys = Object.getOwnPropertyNames(collection);

if (typeof sortObjectKeys !== 'undefined') {
keys.sort(sortObjectKeys);
switch (typeof sortObjectKeys) {
case 'boolean':
keys.sort();
break;
case 'function':
keys.sort(sortObjectKeys);
break;
default:
// Do nothing
}

keys = keys.slice(from, to + 1);
Expand Down