src/Skeleton.js
function wrapContext(context) {
  var retObj = {},
      reservedRegexp = /^(topic|beforeEach|afterEach)$/,
      key,
      subcontext,
      beforeFn = context.beforeEach,
      afterFn = context.afterEach;

  // Iterate the keys in the context
  for (key in context) {
    if (context.hasOwnProperty(key) && !reservedRegexp.test(key)) {
      subcontext = context[key];

      // If the subcontext is a function, wrap it
      if (typeof subcontext === 'function') {
        retObj[key] = wrap(subcontext, beforeFn, afterFn);
      } else {
      // Otherwise, copy it
        retObj[key] = subcontext;
      }
    }
  }

  // Copy over the topic
  retObj.topic = context.topic;

  // Return the copied context
  return retObj;
}
function wrapContext(context) {
  var retObj = {},
      reservedRegexp = /^(topic|beforeEach|afterEach)$/,
      key,
      subcontext,
      beforeFn = context.beforeEach,
      afterFn = context.afterEach;

  // Iterate the keys in the context
  for (key in context) {
    if (context.hasOwnProperty(key) && !reservedRegexp.test(key)) {
      subcontext = context[key];

      // If the subcontext is a function, wrap it
      if (typeof subcontext === 'function') {
        retObj[key] = wrap(subcontext, beforeFn, afterFn);
      } else {
      // Otherwise, copy it
        retObj[key] = subcontext;
      }
    }
  }

  // Copy over the topic
  retObj.topic = context.topic;

  // Return the copied context
  return retObj;
}
function wrapContext ( context ) { var retObj = { } , reservedRegexp = / ^(topic|beforeEach|afterEach)$ / , key , subcontext , beforeFn = context . beforeEach , afterFn = context . afterEach ; // Iterate the keys in the context for ( key in context ) { if ( context . hasOwnProperty ( key ) && ! reservedRegexp . test ( key ) ) { subcontext = context [ key ] ; // If the subcontext is a function, wrap it if ( typeof subcontext === 'function' ) { retObj [ key ] = wrap ( subcontext , beforeFn , afterFn ) ; } else { // Otherwise, copy it retObj [ key ] = subcontext ; } } } // Copy over the topic retObj . topic = context . topic ; // Return the copied context return retObj ; }
Helper/sugar method for wrap
@param {Object} context Context to wrap all functions of (except topic, beforeEach, afterEach)
@returns {Object} Duplicate context object with removed .beforeEach, .afterEach and all replaced functions (except topic)
 TODO: Test if I begin using
Helper / sugar method for wrap