-
-
Save caleywoods/e651c32039dfdc60635d 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
/* This adds two methods first() and last() to Arrays. | |
* These methods are used throughout this file, removing | |
* them will cause things to break. If these need to be | |
* removed you need to replace first() with Array[0] and last | |
* with Array[array.length - 1] | |
*/ | |
Array.prototype.first = function () { return this[0]; }; | |
Array.prototype.last = function () { return this[this.length - 1]; }; | |
/* This adds a method to String objects that allows you to test | |
* whether or not a certain character or string exists in a target | |
* string. In raw JS you need to check for .indexOf("test") !== -1 | |
*/ | |
String.prototype.contains = function( it ) { return this.indexOf( it ) !== -1; }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment