Skip to content

Instantly share code, notes, and snippets.

@designeng
Created March 17, 2014 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save designeng/9600106 to your computer and use it in GitHub Desktop.
Save designeng/9600106 to your computer and use it in GitHub Desktop.
define ->
findNested = (obj, key, memo) ->
i = undefined
memo = [] if Object::toString.call(memo) isnt "[object Array]"
for i of obj
if Object::hasOwnProperty.call(obj, i)
if i is key
memo.push obj[i]
else findNested obj[i], key, memo if Object::toString.call(obj[i]) is "[object Object]"
memo
@designeng
Copy link
Author

Moved from core/utils/object - not used hitherto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment