public
Created

This is an implementation of http://stackoverflow.com/a/4673436/1258486 for CoffeeScript.

  • Download Gist
string-format.coffee
CoffeeScript
1 2 3 4 5
if String.prototype.format is undefined
String.prototype.format = () ->
_arguments = arguments
this.replace /{(\d+)}/g, (match, number) ->
if typeof _arguments[number] isnt 'undefined' then _arguments[number] else match

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.