Skip to content

Instantly share code, notes, and snippets.

@coreequip
Created March 12, 2015 11:38
Show Gist options
  • Save coreequip/2ee425459c1381778f0d to your computer and use it in GitHub Desktop.
Save coreequip/2ee425459c1381778f0d to your computer and use it in GitHub Desktop.
A String.replacePlaceholder- function - Call: 'Text {place} and {holder}'.replacePlaceholder({ 'place': 'foo', 'holder': 'bar' })
String.prototype.replacePlaceholder=function(A){return this.replace(/\{(\w+)}/g,function(B,C){return A[C]})};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment