jsonfiller

Fill JSONs with objects attributes


Keywords
json, filler, object
License
ISC
Install
npm install jsonfiller@1.0.0

Documentation

What is this?

This is an NPM packge to fill JSONs with objects attributes.

Instalation

npm i jsonFiller --save

Then ...

import { jsonFiller } from 'jsonFiller';

/* example object */
let object = {
    id: 123,
    name: 'Jon Doe',
    company: 'Skynet'
}
let jsonMap = {
    userId: object.id,
    userName: object.name,
    userCompany: object.company
}

let jsonFilled = jsonFiller(object, jsonMap);
/* 
 * This module will return a json with filled values:
 * {
 *   userId: 123,
 *   userName: 'Jon Doe',
 *   userCompany: 'Skynet'
 * }
 */
console.log(jsonFilled);