qw
Quoted word literals!
Last updated 3 years ago by iarna .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install qw 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.1                                ...           latest (3 years ago)

3 Versions

  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.1 [deprecated]           ...           6 years ago

Copyright 2014 - 2016 © taobao.org |