Created
March 17, 2014 14:24
-
-
Save designeng/9600106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moved from core/utils/object - not used hitherto