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

assign.js

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assign.js

Tiny libary to assign objects

  • 2.8.9
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Assign.js - dependency-free very minimal assign function

NPM

js-standard-style

========

Assign.js is an extremely tiny helper function to assign objects

Usage Rules

Usage

Command line:

npm install assign.js --save

In JS code:

var assigner = require('assign.js');
...
assigner.assign( obj1, obj2[, obj3[, objN]] );

Respect will force assignment if property already exist

Options:

assigner.validvalues( true )

Assign.js will set only non 'null'-like values from source object. False by default.

assigner.respect( true )

Assign.js will respect the already existing non-empty values of keys. False by default.

assigner.recursive( true )

Tells assigner to walk recursively when assigning objects. Yes by default.

assigner.attributes( [] )

Defines the list of keys allowed to be assigned.

assigner.attributes( [] )

Defines the list of keys excluded to be assigned.

assigner.primitives( [] )

Defines the list of keys considered as values to be assigned preventing to recursively processed.

assigner.blueprinting( true )

If it is set to 'true', Assign.js will consider the keyset of the destination object as reference otherwise key-set will be read from the object assigned from.

assigner.forceful( true )

This option will follow the path of the source object eventually overwriting the one found in the dest object.

Other services:

assigner.pick(object, properties)

This will project the object into a new object possessing the properties defined by the 2nd parameter which might be given as array or varargs as well.

assigner.cloneObject( source )

This created a cloned object from the source copied recursively.

assigner.mask( source, mask )

This created an object with the references only allowed by the mask object.

assigner.purify( source, mask )

This created an object with the references only not denifed by the mask object.

Keywords

FAQs

Package last updated on 05 Dec 2019

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