Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Assign.js - dependency-free very minimal assign function
========
Assign.js is an extremely tiny helper function to assign objects
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
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.
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.
FAQs
Tiny libary to assign objects
We found that assign.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.