diff --git a/lib/local-cache.js b/lib/local-cache.js index 168ab3f..198c605 100644 --- a/lib/local-cache.js +++ b/lib/local-cache.js @@ -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;