Skip to content

Instantly share code, notes, and snippets.

@eddieantonio
Created October 19, 2014 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddieantonio/9cb787ec122c92e50a73 to your computer and use it in GitHub Desktop.
Save eddieantonio/9cb787ec122c92e50a73 to your computer and use it in GitHub Desktop.
# Code transliterated from
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Compatibility
unless String::trim
do ->
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g
String::trim = -> @replace(rtrim, '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment