Skip to content

Instantly share code, notes, and snippets.

View codyburleson's full-sized avatar

Cody Burleson codyburleson

View GitHub Profile
@codyburleson
codyburleson / dust-replace-helper.js
Created October 24, 2014 03:32
String replace helper for Dustjs
(function (dust) {
/**
* Polyfill to create String.trim() if it's not natively available
*/
if (!String.prototype.trim) {
(function(){
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
String.prototype.trim = function () {
@codyburleson
codyburleson / JavaScript Map
Last active April 12, 2022 14:32
Java Map in JavaScript - An object that maps keys to values.
/**
* An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
* For those familiar with the Java programming language, this is similar to a HashMap; it implements most of the
* methods defined by Java's java.util.Map interface.
*
* @constructor
* @version 1.1.0
* @author cody@base22.com Burleson, Cody
*/
function Map() {