lib/plugins/context.js
function decorate(obj) {
    utils.define(obj, 'merge', function() {
      var args = [].concat.apply([], [].slice.call(arguments));
      var len = args.length;
      var idx = -1;

      while (++idx < len) {
        var val = args[idx];
        if (!utils.isObject(val)) continue;
        if (val.hasOwnProperty('hash')) {
          // shallow clone and delete the `data` object
          val = utils.merge({}, val, val.hash);
          delete val.data;
        }
        utils.merge(obj, val);
      }
      // ensure methods aren't overwritten
      decorate(obj);
      if (obj.hasOwnProperty('app') && obj.hasOwnProperty('options')) {
        decorate(obj.options);
      }
      return obj;
    });

    utils.define(obj, 'get', function(prop) {
      return utils.get(obj, prop);
    });

    utils.define(obj, 'set', function(key, val) {
      return utils.set(obj, key, val);
    });
  }
function decorate(obj) {
    utils.define(obj, 'merge', function() {
      var args = [].concat.apply([], [].slice.call(arguments));
      var len = args.length;
      var idx = -1;

      while (++idx < len) {
        var val = args[idx];
        if (!utils.isObject(val)) continue;
        if (val.hasOwnProperty('hash')) {
          // shallow clone and delete the `data` object
          val = utils.merge({}, val, val.hash);
          delete val.data;
        }
        utils.merge(obj, val);
      }
      // ensure methods aren't overwritten
      decorate(obj);
      if (obj.hasOwnProperty('app') && obj.hasOwnProperty('options')) {
        decorate(obj.options);
      }
      return obj;
    });

    utils.define(obj, 'get', function(prop) {
      return utils.get(obj, prop);
    });

    utils.define(obj, 'set', function(key, val) {
      return utils.set(obj, key, val);
    });
  }
function decorate ( obj ) { utils . define ( obj , 'merge' , function ( ) { var args = [ ] . concat . apply ( [ ] , [ ] . slice . call ( arguments ) ) ; var len = args . length ; var idx = - 1 ; while ( ++ idx < len ) { var val = args [ idx ] ; if ( ! utils . isObject ( val ) ) continue ; if ( val . hasOwnProperty ( 'hash' ) ) { // shallow clone and delete the `data` object val = utils . merge ( { } , val , val . hash ) ; delete val . data ; } utils . merge ( obj , val ) ; } // ensure methods aren't overwritten decorate ( obj ) ; if ( obj . hasOwnProperty ( 'app' ) && obj . hasOwnProperty ( 'options' ) ) { decorate ( obj . options ) ; } return obj ; } ) ; utils . define ( obj , 'get' , function ( prop ) { return utils . get ( obj , prop ) ; } ) ; utils . define ( obj , 'set' , function ( key , val ) { return utils . set ( obj , key , val ) ; } ) ; }
Decorate the given object with `merge`, `set` and `get` methods
Decorate the given object with merge set and get methods