object-inject

0.0.2 • Public • Published

object-inject

Inject a new object into an existing one at a certain position.

Example

var objectInject = require('object-inject');
 
var original = {
  created: new Date(),
  modified: new Date(),
  name: 'Test!',
  status: 'active'
};
 
var injectThis = {
  info: {
    created_by: 'me',
    modified_by: 'you'
  }
};
 
var newObject = objectInject(original, injectThis, 'name', 'before');

Readme

Keywords

Package Sidebar

Install

npm i object-inject

Weekly Downloads

4

Version

0.0.2

License

MIT

Last publish

Collaborators

  • dustinwtf