Skip to content

Instantly share code, notes, and snippets.

View iamnabink's full-sized avatar
💭
Thank you for your time 💚

Nabraj Khadka iamnabink

💭
Thank you for your time 💚
View GitHub Profile
@shakhal
shakhal / find_values.js
Last active January 27, 2023 22:52
Find values in JSON by key, recursively
function findValues(obj, key){
return findValuesHelper(obj, key, []);
}
function findValuesHelper(obj, key, list) {
if (!obj) return list;
if (obj instanceof Array) {
for (var i in obj) {
list = list.concat(findValuesHelper(obj[i], key, []));
}