Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assign-fields

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

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

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 23 Aug 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc