swap-props

0.0.0-semantically-released • Public • Published

swap-props

A simple library for swapping property values to each other within an object

Usage

Assume that we have a simple object (literal) in JS:

let obj = {
  a: 'b',
  b: 'a'
}

And want to exchange the values between properties as swapping the value of a with the value of b properties:

obj = swapProps(obj, [a], [b])
 
// result : 
// let obj = {
//   a: 'a',
//   b: 'b'
// }

Licence

MIT

Package Sidebar

Install

npm i swap-props

Weekly Downloads

3

Version

0.0.0-semantically-released

License

MIT

Last publish

Collaborators

  • hwclass