0.2.1 • Published 9 years ago

move-property v0.2.1

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

move-property NPM version

Move a property from one object to another.

Install

Install with npm

$ npm i move-property --save

Usage

var move = require('move-property');

Examples

Move a property:

var one = {a: 'b'};
var two = {};
move(one, two, 'a');

console.log(one);
//=> {}
console.log(two)
//=> {a: 'b'}

Move a nested property:

var one = {a: {b: 'c'}};
var two = {};
move(one, two, 'a.b');

console.log(one);
//=> {a: {}}
console.log(two);
//=> {a: {b: 'c'}}

Related projects

  • get-value: Use property paths (a.b.c) to get a nested value from an object. | homepage
  • set-value: Create nested values and any intermediaries using dot notation ('a.b.c') paths. | homepage
  • unset-value: Delete nested properties from an object using dot notation. | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on October 31, 2015.