object-property-replacer

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

Usage no npm install needed!

<script type="module">
  import objectPropertyReplacer from 'https://cdn.skypack.dev/object-property-replacer';
</script>

README

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.