I have a function that override primary types in CoffeeScript, but this function returnin value and I want to change itself.
String::replaceAll = (what, to) ->
regexPattern = new RegExp(what, "g")
this.replace regexPattern, to
Now I have to use this in this way:
test = test.replaceAll "sth", "sth2"
I want to use this in this way:
test.replaceAll "sth", "sth2" # only, without assigning
(this = this.replace regexPattern, to # doesn't work)