Created
July 19, 2011 15:30
-
-
Save ibolmo/1092786 to your computer and use it in GitHub Desktop.
Revisions
-
ibolmo revised this gist
Jul 19, 2011 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,14 @@ /* --- name: String.substitute description: Replaces Core/String.substitute with an augmented version that supports More/Object.Extras's getFromPath. requires: [Core/String, More/Object.Extras] provides: [String.substitute] ... */ -
ibolmo created this gist
Jul 19, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ /* --- ... */ String.implement({ substitute: function(object, regexp){ return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ if (match.charAt(0) == '\\') return match.slice(1); return Object.getFromPath(object, name) || ''; }); } });