secret
Created

  • Download Gist
functions.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* 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; };

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.