Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    @perl/qwpublic

    @perl/qw

    Quoted word literals!

    const qw = require('@perl/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.

    Keywords

    none

    install

    npm i @perl/qw

    Downloadsweekly downloads

    2

    version

    1.0.1

    license

    ISC

    homepage

    perl

    repository

    githubgithub

    last publish

    collaborators

    • avatar