Created
September 9, 2015 14:16
-
-
Save Mati365/cf23bf0f8280c4a102e3 to your computer and use it in GitHub Desktop.
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
String.prototype['format'] = function(...params: any[]): string { | |
return this.replace(/\{(\w*)\}/g, (match, val) => { | |
return isNaN(val) ? params[0][val] : params[val]; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment