merge-batch2json

1.0.0 • Public • Published

Merge BATCH 2 JSON

Replace string in JSON using BATCH patter with BATCH file vars

Install using:

npm install merge-batch2json --save

Simple usage :

const merge = require('merge-batch2json');
var configData = await merge( __dirname + '\\myConfig.json', __dirname + '\\myVars.bat'  );

The myConfig.json has the following content:

{
    "connections":{
        "webservice":{
            "ip"    :"%SERVER_IP%",
            "port"  :"%SERVER_PORT%"
        }
    }
}

myVars.bat has the following content:

@ECHO OFF
cd %~dp0
SET SERVER_IP= 127.0.0.1
SET SERVER_PORT= 1234

The result output will be:

{
    "connections":{
        "webservice":{
            "ip"    :"127.0.0.1",
            "port"  :"1234"
        }
    }
}

Package Sidebar

Install

npm i merge-batch2json

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.59 kB

Total Files

9

Last publish

Collaborators

  • alanlucian