lib/mongoose-hidden.js
function(obj, path, value) {
  const parts = path.split('.')

  /* traverse existing path to nearest object */
  while (parts.length > 1 && typeof obj[parts[0]] === 'object') {
    obj = obj[parts.shift()]
  }

  /* set value */
  obj[parts[0]] = partsToValue(parts.slice(1), value)
}
function(obj, path, value) {
  const parts = path.split('.')

  /* traverse existing path to nearest object */
  while (parts.length > 1 && typeof obj[parts[0]] === 'object') {
    obj = obj[parts.shift()]
  }

  /* set value */
  obj[parts[0]] = partsToValue(parts.slice(1), value)
}
function ( obj , path , value ) { const parts = path . split ( '.' ) /* traverse existing path to nearest object */ while ( parts . length > 1 && typeof obj [ parts [ 0 ] ] === 'object' ) { obj = obj [ parts . shift ( ) ] } /* set value */ obj [ parts [ 0 ] ] = partsToValue ( parts . slice ( 1 ) , value ) }
Set a value in object denoted by dot-path

@access private
@param {object} obj source object
@param {string} path a dot-path
@param {mixed} value the value to set at the end of the path
Set a value in object denoted by dot - path