From e6738bd3ec257b3f35e04bc5b73e3b6de93772fb Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 18 Dec 2019 21:26:23 -0500 Subject: Search through JSON object keys --- lib/app.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/app.js b/lib/app.js index 0eb576e..7caab05 100644 --- a/lib/app.js +++ b/lib/app.js @@ -252,8 +252,10 @@ function forSome(each) { if (obj == null) return false if (typeof obj === 'string') return each(obj) if (Array.isArray(obj)) return obj.some(some) - if (typeof obj === 'object') - for (var k in obj) if (some(obj[k])) return true + if (typeof obj === 'object') for (var k in obj) { + if (each(k)) return true + if (some(obj[k])) return true + } return false } } -- cgit v1.2.3