Consider all object params as keys if none exists

This commit is contained in:
Zaid Abdulla committed 2017-05-18 14:15:15 -07:00
1 parent 7fdd04343b
commit 4d255acfc6
1 file changed
+7
+7
View File
@@ -100,6 +100,13 @@ function refresh(callback) {
return counter = 0;
}
// If no keys are defined, consider all parameters as keys to keep the
// same behavior from v1.0
for (let obj of objects) {
if (!obj["_keys"] || !obj["_keys"].length)
obj["_keys"] = Object.keys(obj).filter(k => !k.startsWith("_"));
}
res.sort((a, b) => {
if (a.weight === b.weight)
return a._id > b._id;