Guest User

Untitled

a guest
Jun 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. function findVal(object, key, value, upgrades) {
  2. Object.keys(object).forEach(function(item) {
  3. if (item === key && object[item] === value) {
  4. upgrades.push(object);
  5. }
  6. if (object[item] && typeof object[item] === 'object') {
  7. findVal(object[item], key, value, upgrades);
  8. }
  9. });
  10.  
  11. return upgrades;
  12. }
Add Comment
Please, Sign In to add comment