0.0.1 • Published 6 years ago

lodash-mapdeepfunctions v0.0.1

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

mapDeepFunctions

lodash mixing like defaultsDeep but for function transforms

Install

npm i lodash-mapdeepfunctions

Usage

const _ = require('lodash')
_.mixin(require('lodash-mapdeepfunctions'))

// create a model with functions
const model = {
  foo: _.toString,
  rootMe: i => i * i,
  nested: {
    bar: _.toNumber
  }
}

console.log(
  _.mapDeepFunctions(model, {
    foo: Buffer.from(`Totally not a string name`),
    rootMe: 5,
    nested: {
      bar: '123'
    }
  })
)