Skip to content

Instantly share code, notes, and snippets.

@benjaminsehl
Last active March 20, 2020 22:53
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 benjaminsehl/6edc7615279553487149db9427fa4688 to your computer and use it in GitHub Desktop.
Save benjaminsehl/6edc7615279553487149db9427fa4688 to your computer and use it in GitHub Desktop.
An ES6 function for fixing Orphans
export function adopt(str) {
return str.replace(/\s([^\s<]+)\s*$/g, '\u00A0$1');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment