Preserve the value of this when applying before advice

This commit is contained in:
Nathan Sobo
2012-06-20 17:55:29 -06:00
parent a8a1a74b11
commit 9c02e05051
2 changed files with 5 additions and 5 deletions

View File

@@ -13,8 +13,8 @@ _.mixin
adviseBefore: (object, methodName, advice) ->
original = object[methodName]
object[methodName] = (args...) ->
unless advice(args...) == false
original(args...)
unless advice.apply(this, args) == false
original.apply(this, args)
escapeRegExp: (string) ->
# Referring to the table here: