code: function objGetObj(obj, _key) {
    var key = Array.isArray(_key) ? _key : String(_key).split('.');
    var p, n, ok=1;
    var ret = {ok:ok, path:key, obj:obj};
    for(p=0; p<key.length; p++) {
      n = key[p];
      if(!obj.hasOwnProperty(n) || isPrimitive(obj[n])) {
        ok = 0;
        break
      }
      obj = obj[n];
    }
    ret.ok= ok;
    ret.path = key.slice(0,p);
    ret.obj=obj;
    return ret
  }
docs: var obj={a:{b:{c:1}}}; objSet(obj, {} ,{x:1}); objSet(obj,'a.b.c.d.e',{x:1}); objSet(obj,'a.f.d.s'.split('.'), {y:1}); console.log(JSON.stringify(obj)) return object path with only object type