"use strict";
var Base = require('../base')

/**
 * @function convert
 * @memberOf Base#
 * @param  {object} [options]
 * @param  {boolean} options.fnToString
 * @return {object}
 */
exports.$define = {
  convert:function( options ) {
    
    if( options ) {
      var fnToString = options.fnToString
      //!unify exclude!
      var exclude = options.exclude
    }

    var key
    var obj = {}
    var val = this._$val

    for( var key$ in this ) {
      //everything needs to get unified in terms of order etc
      //exclude maybe adden als helper functie
      if ( key$[0] !== '_' && (!exclude||!exclude(key$, this)) ) {
        key = this[key$]
        if( key ) {
          obj[key$] = key.convert && key.convert(options) || key
        }
      }
    }

    if( val !== void 0 ) {
      if( fnToString && typeof val === 'function' ) {
        obj.$val = String( val )
      } else {
        if( val instanceof Base ) {
          //hier parsen van ref als optie maken ($val)
          obj.$val = {
            $reference: val.$path
          }
        } else {
          obj.$val = val
        }
      }
    }

    return obj

  }
}

@@ -66,116 +66,402 @@
 vert
-%0A * @memberOf Base#%0A * @param  %7Bobject%7D %5Boptions%5D%0A * @param  %7Bboolean%7D options.fnToString%0A * @return %7Bobject
+s the Base object into a normal javascript wObject, ignoring internal properties.%0A *  It also converted nested objects which in turn are childConstructor instances.%0A * @memberOf Base#%0A * @param  %7Bobject%7D %5Boptions%5D%0A * @param  %7Bboolean%7D options.fnToString%0A * @return %7Bobject%7D%0A * @example%0A * %09var a = new Base(%7B $key: 'a', $val: 123%7D)%0A * %09console.log(a.convert()) //it logs %7B $key: 'a', $val: 123 
 %7D%0A *
@@ -518,16 +518,41 @@
 ) %7B%0A    
+var exclude, fnToString;%0A
 %0A    if(
@@ -570,20 +570,16 @@
 %7B%0A      
-var 
 fnToStri
@@ -628,28 +628,24 @@
 lude!%0A      
-var 
 exclude = op
@@ -672,24 +672,29 @@
 %0A    var key
+Value
 %0A    var obj
@@ -942,16 +942,21 @@
      key
+Value
  = this%5B
@@ -976,16 +976,21 @@
  if( key
+Value
  ) %7B%0A   
@@ -1007,24 +1007,29 @@
 %5Bkey$%5D = key
+Value
 .convert && 
@@ -1031,16 +1031,21 @@
 t && key
+Value
 .convert
@@ -1060,16 +1060,21 @@
 ) %7C%7C key
+Value
 %0A       
@@ -1462,15 +1462,14 @@
 urn obj%0A
-%0A
   %7D%0A%7D%0A

improve methods/convert docs and variable names