Created
September 3, 2013 00:51
-
-
Save evanleck/6418552 to your computer and use it in GitHub Desktop.
A custom include function to shortcut around the rather robust verbiage required for the "some" method.
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
# include | |
# depends on some, a shim for which can be found at https://gist.github.com/l3ck/6418548 | |
if "function" isnt typeof Array::include | |
Array::include = (sought_value) -> | |
"use strict" | |
# throw on null | |
throw new TypeError("Array.prototype.include called on null or undefined") if null is this or "undefined" is typeof this | |
@some (element, index, array) -> | |
element is sought_value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment