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
// Douglas Crockford's Supplant | |
if(!String.prototype.supplant){ | |
String.prototype.supplant = function(o){ | |
return this.replace(/\{([^{}]*)\}/g, function(a, b){ | |
var r = o[b]; | |
return typeof r === 'string' || typeof r === 'number' ? r : a; | |
}); | |
}; | |
} |
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
Array.prototype.remove = function(obj){ | |
// Copy the array, so we don't override it | |
var array = this.slice(0); | |
for(var i = 0; i < array.length; i++){ | |
// Use while-loop to find adjacent equal objects | |
while(array[i] === obj){ | |
// Remove this[i] | |
array.splice(i, 1)[0]; |
NewerOlder