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

assign-defined

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assign-defined - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

logfile

29

index.js

@@ -1,30 +0,3 @@

var assign = require('object-assign')
var assignFilter = require('assign-filter')
function assignFilter(filter, target, ...args) {
var args = Array.prototype.slice.call(arguments, 2)
var filteredArgs = args.map(function(obj) {
if (obj == null) {
return obj
}
return Object.keys(obj).reduce(function(acc, propName) {
var value = obj[propName]
if (filter(value, propName, obj)) {
acc[propName] = value
}
return acc
}, {})
})
return assign.apply(null, [target].concat(filteredArgs))
}
function isDefined(value) {
return value !== undefined
}
module.exports = function(target) {

@@ -31,0 +4,0 @@ var sources = Array.prototype.slice.call(arguments, 1)

{
"name": "assign-defined",
"version": "1.0.0",
"version": "1.0.1",
"description": "Object.assign that skips any undefined properties from source objects",

@@ -27,4 +27,4 @@ "main": "index.js",

"dependencies": {
"object.assign": "^4.0.3"
"assign-filter": "^1.0.0"
}
}
# assign-defined
Object.assign that skips any undefined properties from source objects
## Install
```sh
$ npm i assign-defined --save
```
## Usage
```js
var assignDefined = require('assign-defined')
var target = {}
//only copy defined properties
assignFilter(target, { a: undefined, b: 1 }, { c: 2 })
//target is { b: 1, c: 2 }
```
## License
#### MIT
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