-
-
Save fxg42/eb2f9ab4e18a09242095f2c1c5b43784 to your computer and use it in GitHub Desktop.
Useless tag function...
This file contains hidden or 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
// | |
// Splits a string containing words separated by spaces into a list of those | |
// words. The function should be used as a tag i.e. | |
// | |
// w`foo bar ${'b' + 'az'}` => [ 'foo', 'bar', 'baz' ] | |
// | |
export const w = (templateObj, ...substitutions) => String.raw({ raw: templateObj }, ...substitutions).trim().split(/\W+/) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment