summaryrefslogtreecommitdiff
path: root/deps/node/deps/npm/node_modules/qw/README.md
blob: 55ba17a91f78656aec27a204b32d635f15764164 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# qw

Quoted word literals!

```js
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:

```js
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:

```js
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.