index.js
function set (obj, keys, value) {
  var i
  var key
  var last
  var tmp = obj || {}

  keys = _splitPath(keys)

  if (!keys || keys.length === 0) {
    return
  }

  last = keys.pop()

  for (i = 0; i < keys.length; i++) {
    key = keys[i]
    if (!tmp[key]) {
      tmp[key] = {}
    }
    if (tmp.hasOwnProperty(key)) {
      tmp = tmp[key]
    }
  }
  if (value === null) {
    delete (tmp[last])
  } else {
    tmp[last] = value
  }
  return obj
}
function set (obj, keys, value) {
  var i
  var key
  var last
  var tmp = obj || {}

  keys = _splitPath(keys)

  if (!keys || keys.length === 0) {
    return
  }

  last = keys.pop()

  for (i = 0; i < keys.length; i++) {
    key = keys[i]
    if (!tmp[key]) {
      tmp[key] = {}
    }
    if (tmp.hasOwnProperty(key)) {
      tmp = tmp[key]
    }
  }
  if (value === null) {
    delete (tmp[last])
  } else {
    tmp[last] = value
  }
  return obj
}
function set ( obj , keys , value ) { var i var key var last var tmp = obj || { } keys = _splitPath ( keys ) if ( ! keys || keys . length === 0 ) { return } last = keys . pop ( ) for ( i = 0 ; i < keys . length ; i ++ ) { key = keys [ i ] if ( ! tmp [ key ] ) { tmp [ key ] = { } } if ( tmp . hasOwnProperty ( key ) ) { tmp = tmp [ key ] } } if ( value === null ) { delete ( tmp [ last ] ) } else { tmp [ last ] = value } return obj }
set a property in `obj`

#### Example

```js
var r,
set = require('mergee').set,
obj = {};
r = set(obj, ['a', 'b'], { c:1 });
//> r = { a: { b: { c: 1 } } }
r = set(obj, 'a.b.d', 2);
//> r = { a: { b: { c:1, d:2 } } }
```

@param {Object} obj - object to select from
@param {Array|String} keys - Array of properties or dot separated string of properties; If using a String avoid using property names containing a `.`
@param {Any} value - The value to set
@return {Object} set object
set a property in obj