1.0.9 • Published 8 years ago

extend_exclude v1.0.9

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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)

Copyright @ Mithriljs_CN

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago