function applyVirtuals(schema, obj, virtuals) {
  if (obj == null) {
    return obj;
  }

  let virtualsForChildren = virtuals;
  let toApply = null;

  if (Array.isArray(virtuals)) {
    virtualsForChildren = [];
    toApply = [];
    for (const virtual of virtuals) {
      if (virtual.length === 1) {
        toApply.push(virtual[0]);
      } else {
        virtualsForChildren.push(virtual);
      }
    }
  }

  applyVirtualsToChildren(schema, obj, virtualsForChildren);
  return applyVirtualsToDoc(schema, obj, toApply);
}
Apply a given schema's virtuals to a given POJO

@param {Schema} schema
@param {Object} obj
@param {Array<string>} [virtuals] optional whitelist of virtuals to apply
@returns