Created
February 1, 2012 23:33
-
-
Save searls/1720156 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
data = | |
a: 0 | |
b: "foo" | |
result = _(data).reject((v,k) -> k == 'b') | |
expect(result).toEqual(a: 0) #but fail! it returns: [0] | |
# so far now, I could settle for this: | |
newData = _(data).clone() | |
_(newData).each (v,k) -> delete newData[k] if k == 'b' |
Thanks Zach. Yeah, I just hacked my own underscore mixin _.withoutProperties
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yea, It does seem odd. I've hacked together a gist that could become a _(data).object_reject: https://gist.github.com/1720187
A better option would be to extend underscore to make it saner when it's iterating over an object.