lib/schema.js
function convertElement (el, self) {
  if (el instanceof Schema) {
    return el.toObject(self);
  }

  if (isObject(el)) {
    return convertObject(el, self);
  }

  if (Array.isArray(el)) {
    return el.map(function (item) {
      return convertElement(item, self);
    })
  }

  return el;
}
function convertElement (el, self) {
  if (el instanceof Schema) {
    return el.toObject(self);
  }

  if (isObject(el)) {
    return convertObject(el, self);
  }

  if (Array.isArray(el)) {
    return el.map(function (item) {
      return convertElement(item, self);
    })
  }

  return el;
}
function convertElement ( el , self ) { if ( el instanceof Schema ) { return el . toObject ( self ) ; } if ( isObject ( el ) ) { return convertObject ( el , self ) ; } if ( Array . isArray ( el ) ) { return el . map ( function ( item ) { return convertElement ( item , self ) ; } ) } return el ; }
Converts a single element to plain object
Converts a single element to plain object