qw
Quoted word literals!
Last updated 3 years ago by iarna .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm 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.2                                ...           latest (3 years ago)

4 Versions

  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.0.1 [deprecated]           ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |