1.0.1 • Published 2 years ago
@tush-tr/jsonmapper v1.0.1
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 😎
License
MIT license © Tushar Rajpoot