Created
September 23, 2011 17:12
-
-
Save rklancer/1237915 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
do => | |
toMatchUsing = (matcher) -> | |
(pairs) -> | |
return false if @actual?.length isnt pairs.length or typeof @actual isnt 'object' | |
return false for a, i in @actual when not matcher( a, pairs[i] ) | |
true | |
@addMatchers( | |
toEqualPairs: toMatchUsing (a, [x, y]) -> a[0] is x and a[1] is y | |
toEqualPointsDefinedBy: toMatchUsing (a, [x, y]) -> a.get('x') is x and a.get('y') is y | |
) |
And matyr for the pointer to the ?. operator
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to TheJH on Freenode #coffeescript for the style advice!