2.0.1 • Published 6 years ago

dotpather-transform v2.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

dotpather-transform

Build Status

tranform nested objects with dotpaths

install

npm i dotpather-transform

usage

var dotpather = require('dotpather-transform')
var transform = dotpather('one.two.three')

var data = {
  one: { 
    two: {
      three: 4
    }
  }
}

var transformed = transform(data, function(number) {
  return number + 1;
})

// { one: { two: { three: 5 } } }

You can also refer to array indexes

var transform = dotpather('one.two.three.1.five.1')
var data = {
  one: { 
    two: {
      three: [4, { five: [ 6, 7 ] }]
    }
  }
}

let obj = transform(data, function(number) {
  return number + 1;
})

// { one: { two: { three: [4, { five: [ 6, 8 ] } ] } } }
2.0.1

6 years ago

2.0.0

6 years ago

1.0.9

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago