Created
January 15, 2014 04:45
-
-
Save tracend/8430911 to your computer and use it in GitHub Desktop.
_.toArray() #underscore #mixin #cc
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
_.mixin({ | |
// - Takes an array-like object and turns it into a real Array | |
// to make all the Array.prototype goodness available. | |
toArray : function ( a ) { | |
return [].slice.call( a ); | |
// alternatively: | |
//Array.prototype.slice.call( a ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment