2.0.1 • Published 5 years ago

dotpather-transform v2.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
5 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

5 years ago

2.0.0

5 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago