qw

1.0.2 • Public • Published

qw

Quoted word literals!

const qw = require('qw')

const myword = qw` this is
  a long list
  of words`
// equiv of:
const myword = [ 'this', 'is', 'a', 'long', 'list', 'of', 'words' ]

You can embed vars in the usual way:

const mywords = qw`product ${23 * 5} also ${'escaping a string'}`
// equiv of:
const mywords = [ 'product', 23 * 5, 'also', 'escaping a string' ]

You can also embed vars inside strings:

const mywords = qw`product=${23 * 5} also "${'escaping a string'}"`
// equiv of:
const mywords = [ 'product=' + (23 * 5), 'also', '"escaping a string"' ]

DESCRIPTION

This uses template strings to bring over this little common convenience from Perl-land.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    77,806
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    77,806
  • 1.0.1
    39,470
  • 1.0.0
    0

Package Sidebar

Install

npm i qw

Weekly Downloads

117,282

Version

1.0.2

License

ISC

Unpacked Size

3.21 kB

Total Files

4

Last publish

Collaborators

  • iarna