Socket
Socket
Sign inDemoInstall

assign-fields

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    assign-fields

deeply assign fields to object, where the fields are build by builders


Version published
Maintainers
1
Install size
124 kB
Created

Readme

Source

Assign Fields

Deeply assign fields to object, where the fields are build by builders.

Installation

npm i assign-fields

Usage

const assignFields = reuqire('assign-fields')
const {compose, prop, upperCase} = require('lodash/fp')

const src = {name: 'Bob', age: 20}
const builder = {
  name: compose(upperCase, prop('name')),
  friend: {
    name: 'Alice',
    age: prop('age')
  }
}

const result = assignFields(builder, src)

// result is {name: 'BOB', age: 20, friend: {name: 'Alice', age: 20}}

Curry

assignFields is curried, so it can be used as assignFields(builder)(src).

License

MIT

FAQs

Last updated on 23 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc