env-string

    1.0.1 • Public • Published

    env-string

    Inlines env vars in a string that contains $NAME expressions

    npm install env-string
    

    Build Status

    Usage

    var env = require('env-string')
    var map = {WORLD: 'world'}
     
    // supports $NAME
    console.log(env('hello $WORLD', map)) // 'hello world'
     
    // supports ${NAME}
    console.log(env('hello ${WORLD}', map)) // 'hello world'
     
    // supports $NAME-something-else
    console.log(env('hello $WORLD-world', map)) // 'hello world-world'
     
    // supports ${NAME:-default-value}
    console.log(env('hello ${VERDEN:-world}', map)) // 'hello world'
     
    // vars default to ''
    console.log(env('hello $VERDEN', map)) // 'hello '

    License

    MIT

    Keywords

    none

    Install

    npm i env-string

    DownloadsWeekly Downloads

    14,947

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.91 kB

    Total Files

    6

    Last publish

    Collaborators

    • mafintosh