Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
LICENSE | D | 12-May-2024 | 752 | 15 | 11 | |
README.md | D | 12-May-2024 | 706 | 36 | 25 | |
package.json | D | 12-May-2024 | 1.2 KiB | 63 | 62 | |
qw.js | D | 12-May-2024 | 1 KiB | 44 | 40 |
README.md
1# qw 2 3Quoted word literals! 4 5```js 6const qw = require('qw') 7 8const myword = qw` this is 9 a long list 10 of words` 11// equiv of: 12const myword = [ 'this', 'is', 'a', 'long', 'list', 'of', 'words' ] 13``` 14 15You can embed vars in the usual way: 16 17```js 18const mywords = qw`product ${23 * 5} also ${'escaping a string'}` 19// equiv of: 20const mywords = [ 'product', 23 * 5, 'also', 'escaping a string' ] 21``` 22 23You can also embed vars inside strings: 24 25```js 26const mywords = qw`product=${23 * 5} also "${'escaping a string'}"` 27// equiv of: 28const mywords = [ 'product=' + (23 * 5), 'also', '"escaping a string"' ] 29``` 30 31## DESCRIPTION 32 33This uses template strings to bring over this little common convenience from 34Perl-land. 35 36