object-property-replacer

A Node.js module to replace the properties of an object by the properties of another object


Keywords
object, property, replacer
License
MIT
Install
npm install object-property-replacer@1.0.0

Documentation

object-property-replacer Build Status

A Node.js module to replace the properties of an object by the properties of another object

Installation

Install using npm:

npm install -S object-property-replacer

Usage

Replace the properties of a destination object by the properties of a source object:

const replacer = require('object-property-replacer');

const destination = {
  'id': 1,
  'email': 'jdoe@example.com',
  'password': '123456',
};

const source = {
  'id': 1,
  'email': 'jdoe@example.com',
  'role': 'user',
};

replacer.replace(destination, source);

// destination = {'id': 1, 'email': 'jdoe@example.com', 'role': 'user'}

License

object-property-replacer is released under the MIT license.