Skip to content

Instantly share code, notes, and snippets.

@petekp
Last active October 18, 2015 21:18
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 petekp/7bd327e611a28e98b566 to your computer and use it in GitHub Desktop.
Save petekp/7bd327e611a28e98b566 to your computer and use it in GitHub Desktop.
Wrap all characters in a string with any XHTML tag (ES6, lodash)
taggify(string, tag) {
let taggedChars = []
_.map(string, function(char) {
taggedChars.push(`<${tag}>${char}</${tag}>`)
})
return taggedChars.join('')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment