Skip to content

Instantly share code, notes, and snippets.

@vincentwoo
Created January 4, 2016 10:53
Show Gist options
  • Save vincentwoo/05cb80b930771b38891f to your computer and use it in GitHub Desktop.
Save vincentwoo/05cb80b930771b38891f to your computer and use it in GitHub Desktop.
class String
def js_length
self.length +
self.each_codepoint.count { |codepoint| codepoint >= 0x10000 && codepoint <= 0x10FFFF }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment