I am trying to write a helper method to find the intersection of two hashes/Objects like this...
Object::intersect = (obj)->
t = {}
t[k] = @[k] for k of obj
t
x = { a: 1, b: 2, c: 3 }
w = { a: true, b: 3 }
x.intersect(w) #=> { a: 1, b: 2, intersect: [Function] }
the results are as I expected/wanted EXCEPT for the addition of 'intersect' key/value.
What am I missing here?
w = { a: true, b: 3, d: 4}, thend: undefinedappears in the result.