Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rviscomi
Created June 3, 2018 18:47
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 rviscomi/c7e4bd91a24a961c4339b81170598fb3 to your computer and use it in GitHub Desktop.
Save rviscomi/c7e4bd91a24a961c4339b81170598fb3 to your computer and use it in GitHub Desktop.
Convenience functions for turning a multi-line string into concatenated single-line strings and back
concat = q => q.split('\n').map(l => `"${l}"`).join('+\n');
multi = q => q.split('\n').map(l => l.replace(/(^"|"\+$)/g, '')).join('\n');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment