Add escapeAttribute to underscore-extensions

This commit is contained in:
Ben Ogle
2013-09-25 15:59:10 -07:00
parent da6aff222b
commit 824049e17a

View File

@@ -28,6 +28,9 @@ _.mixin
escapeRegExp: (string) ->
string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
escapeAttribute: (string) ->
string.replace(/"/g, '"').replace(/\n/g, '')
humanizeEventName: (eventName, eventDoc) ->
[namespace, event] = eventName.split(':')
return _.undasherize(namespace) unless event?