       if isFunction(needle)
         needle(key, val)
 
-      if isObject(val)
+      if isObjectOrArray(val)
         find(val, needle, memo)
 
   return memo


find = (haystack, needle, memo = []) ->

  # isObject returns true from both objects and arrays
  if needle and isObject(haystack)

    if needle of haystack
      memo.push haystack[needle]


isFunction = require 'is-function'
isObjectOrArray   = require 'is-object'
isArray           = require 'is-array'

###
when passed an object, returns an array of its keys.
