Skip to content

Commit

Permalink
Merge pull request #11401 from Uzlopak/impr-hasDollarKeys
Browse files Browse the repository at this point in the history
impr: hasDollarKeys
  • Loading branch information
vkarpov15 authored Feb 17, 2022
2 parents 07afbd5 + f1c2a72 commit 633f2d4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/helpers/query/hasDollarKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
* ignore
*/

module.exports = function(obj) {
if (obj == null || typeof obj !== 'object') {
module.exports = function hasDollarKeys(obj) {

if (typeof obj !== 'object' || obj === null) {
return false;
}

const keys = Object.keys(obj);
const len = keys.length;

for (let i = 0; i < len; ++i) {
if (keys[i].startsWith('$')) {
if (keys[i][0] === '$') {
return true;
}
}

return false;
};

0 comments on commit 633f2d4

Please sign in to comment.