lib/schema/transform.js
function traverse(value, cbs) {
  cbs = cbs || {};

  if (Array.isArray(value)) {
    if (cbs.beforeArray) value = cbs.beforeArray(value, cbs);

    value = value.map(function(v) {
      return traverse(v, cbs);
    });

    if (cbs.afterArray) value = cbs.afterArray(value, cbs);
  } else if (typeof value === 'object') {
    if (cbs.beforeObject) value = cbs.beforeObject(value, cbs);

    Object.keys(value).forEach(function(key) {
      value[key] = traverse(value[key], cbs);
    });

    if (cbs.afterObject) value = cbs.afterObject(value, cbs);
  }

  return value;
}
function traverse(value, cbs) {
  cbs = cbs || {};

  if (Array.isArray(value)) {
    if (cbs.beforeArray) value = cbs.beforeArray(value, cbs);

    value = value.map(function(v) {
      return traverse(v, cbs);
    });

    if (cbs.afterArray) value = cbs.afterArray(value, cbs);
  } else if (typeof value === 'object') {
    if (cbs.beforeObject) value = cbs.beforeObject(value, cbs);

    Object.keys(value).forEach(function(key) {
      value[key] = traverse(value[key], cbs);
    });

    if (cbs.afterObject) value = cbs.afterObject(value, cbs);
  }

  return value;
}
function traverse ( value , cbs ) { cbs = cbs || { } ; if ( Array . isArray ( value ) ) { if ( cbs . beforeArray ) value = cbs . beforeArray ( value , cbs ) ; value = value . map ( function ( v ) { return traverse ( v , cbs ) ; } ) ; if ( cbs . afterArray ) value = cbs . afterArray ( value , cbs ) ; } else if ( typeof value === 'object' ) { if ( cbs . beforeObject ) value = cbs . beforeObject ( value , cbs ) ; Object . keys ( value ) . forEach ( function ( key ) { value [ key ] = traverse ( value [ key ] , cbs ) ; } ) ; if ( cbs . afterObject ) value = cbs . afterObject ( value , cbs ) ; } return value ; }
Traverse object.
Traverse object .