'use strict';

var _slice = Array.prototype.slice;

exports = module.exports = {};

// dependencies
//
exports.type = require('utils-type');
exports.merge = require('lodash.merge');
exports.reduce = require('lodash.reduce');
exports.inherits = require('inherits');
exports.asyncDone = require('async-done');

// assorted
//

exports.slice = function slice(args, index, top){
  return _slice.call(args, index, top);
};

exports.isFunction = function isFunction(value){
  return typeof value === 'function';
};

exports.mapPush = function mapPush(argv, args, pos){
  if(!args.length){ return argv; }

  pos = (Number(pos) || 0) - 1;
  var top = argv.length;
  var len = args.length;

  var index = -1;
  while(++pos < len){
    if(++index < top){
      argv[index] = args[pos];
    } else {
      argv.push(args[pos]);
    }
  }

  return argv;
};

exports.classFactory = function classFactory(SuperCtor){
  return function extendsConstructor(mixin){
    function Ctor(props){
      if(!(this instanceof Ctor)){
        return new Ctor(props);
      }
      SuperCtor.apply(this, arguments);
    }
    exports.inherits(Ctor, SuperCtor);
    exports.merge(Ctor.prototype, exports.type(mixin).plainObject);
    return Ctor;
  };
};

@@ -408,24 +408,203 @@
 , top);%0A%7D;%0A%0A
+exports.siteID = function siteID(site, index)%7B%0A  if(site.stack)%7B return '(' + site.stack.tree().label + ')'; %7D%0A  return site.name %7C%7C site.displayName %7C%7C index + ':anonymous';%0A%7D;%0A%0A
 exports.isFu

move Stack utility function to util