Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tush-tr/jsonmapper

A nodejs library which allows you to fill a object values to your target object
https://github.com/tush-tr/jsonmapper

javascript nodejs npm npm-module npm-package reactjs

Last synced: about 1 month ago
JSON representation

A nodejs library which allows you to fill a object values to your target object

Awesome Lists containing this project

README

        

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
```sh
npm install @tush-tr/jsonMapper
```

## Import the package

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

## Functions

### objectFill

```js
const desiredObj = objectFill(target, source)
```

#### Example:

```js
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

```js
let assignJson = jsonFill(targetFilePath, sourceFilePath, outputJsonFilePath)
```

#### Example:

```js
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](https://twitter.com/tush_tr604)

## License

[MIT license](LICENSE) © Tushar Rajpoot