Created
November 6, 2014 01:26
-
-
Save thetallweeks/8c7518a14f37e43d567c to your computer and use it in GitHub Desktop.
little function for escaping double curly brackets
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 characters
var entityMap = { | |
"{{": "<span>{{</span>", | |
"}}": "<span>}}</span>" | |
}; | |
function escapeCurlyBrackets(source: string) { | |
return String(source).replace(/{{|}}/g, s => entityMap[s]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment