function applyGetters(self, json, type, options) {
  var schema = self.schema,
      paths = Object.keys(schema[type]),
      i = paths.length,
      path;

  while (i--) {
    path = paths[i];

    var parts = path.split('.'),
        plen = parts.length,
        last = plen - 1,
        branch = json,
        part;

    for (var ii = 0; ii < plen; ++ii) {
      part = parts[ii];
      if (ii === last) {
        branch[part] = clone(self.get(path), options);
      } else {
        branch = branch[part] || (branch[part] = {});
      }
    }
  }

  return json;
}
/*!
 * Applies virtuals properties to `json`.
 *
 * @param {Document} self
 * @param {Object} json
 * @param {String} type either `virtuals` or `paths`
 * @return {Object} `json`
 */
Applies virtuals properties to `json`.
Applies virtuals properties to ` json ` .
function applyGetters(self, json, type, options) {
  var schema = self.schema,
      paths = Object.keys(schema[type]),
      i = paths.length,
      path;
  while (i--) {
    path = paths[i];
    var parts = path.split('.'),
        plen = parts.length,
        last = plen - 1,
        branch = json,
        part;
    for (var ii = 0; ii < plen; ++ii) {
      part = parts[ii];
      if (ii === last) {
        branch[part] = clone(self.get(path), options);
      } else {
        branch = branch[part] || (branch[part] = {});
      }
    }
  }
  return json;
}
function applyGetters ( self , json , type , options ) { var schema = self . schema , paths = Object . keys ( schema [ type ] ) , i = paths . length , path ; while ( i -- ) { path = paths [ i ] ; var parts = path . split ( '.' ) , plen = parts . length , last = plen - 1 , branch = json , part ; for ( var ii = 0 ; ii < plen ; ++ ii ) { part = parts [ ii ] ; if ( ii === last ) { branch [ part ] = clone ( self . get ( path ) , options ) ; } else { branch = branch [ part ] || ( branch [ part ] = { } ) ; } } } return json ; }
Applies virtuals properties to `json`.
Applies virtuals properties to ` json ` .