Created
May 27, 2016 18:29
-
-
Save audionerd/ceaf691e729fdfb42394703ccbb66538 to your computer and use it in GitHub Desktop.
Widon’t for React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
// Widon’t for React Native | |
// Simply uses Unicode \u00a0 instead of | |
// | |
// via http://webservices.blog.gustavus.edu/2007/03/20/shaun-inmans-widont-ported-to-javascript/ | |
export const widont = (text) => text.replace(/([^\s])\s+([^\s]+)\s*$/, '$1\u00a0$2') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment