npm.io
1.0.1 • Published 4 years ago

@tush-tr/jsonmapper

Licence
MIT
Version
1.0.1
Deps
0
Size
5 kB
Vulns
0
Weekly
0

tush_tr604

JsonMapper

A nodejs library which allows you to assign a json file values with another json file and create a new desired json file.

Installing the package

npm install @tush-tr/jsonMapper

Import the package

const {objectFill,jsonFill} = require('@tush-tr/jsonmapper')

Functions

objectFill
const desiredObj = objectFill(target, source)
Example:
const {objectFill,jsonFill} = require('@tush-tr/jsonmapper')
const targetObj = {
    name: "Rahul",
    class: 12
}

const sourceObj = {
    class: 10,
    role: "Monitor",
    name: "Tushar"
}
const assignedObj = objectFill(targetObj,sourceObj)
console.log(assignedObj)
// { name: 'Tushar', class: 10 }
jsonFill
let assignJson = jsonFill(targetFilePath, sourceFilePath, outputJsonFilePath)
Example:
const fillJson = jsonFill('target.json','source.json','output.json')
console.log(fillJson)
// done...

Contributing

I welcome pull requests, bug fixes and issue reports. Before proposing a change, please discuss your change by raising an issue.

Maintainer

Tushar Rajpoot

License

MIT license Tushar Rajpoot