Socket
Book a DemoInstallSign in
Socket

extend_exclude

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

extend_exclude

Javascript object _extend()/_exclude() for deeply operate two object

latest
Source
npmnpm
Version
1.0.9
Version published
Maintainers
1
Created
Source

extend_exclude Build Status

js object _extend()/_exclude() for deeply operate two object

Usage:

var _extend = require('extend_exclude')._extend
var _exclude = require('extend_exclude')._exclude
var a = {
  x:1,
  y:{
    z:2
  }
}

var b= {
  y:{
    z:10,
    u:'name'
  }
}
_extend(a,b)
_exclude(a,b)

_extend( a, b )

Deeply merge b properties into a

_extend( a, b )

{
  x:1,
  y:{
    z:10,
    u:'name'
  }
}

_exclude( a, exclude_obj, [newValue] )

Deeply delete exclude_obj(if key has a truthy value) from a, optionally set to newValue if present

_exclude( a, { y:{z:1} } )

{
  x:1,
  y:{
    u:'name'
  }
}

_exclude( a, { y:{z:10} } , null)

{
  x:1,
  y:{
    z:null,
    u:'name'
  }
}

_deepIt( a, b, callback )

Iterate deeply with a && b simultaneously, and callback(objA, objB, key)

_deepIt( a, b, function(objA,objB,key){
    objA[key] = objB[key]
} )
---> same result of _extend(a,b)

Keywords

object extend

FAQs

Package last updated on 24 Jun 2016

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