/**
 * Sets Up Methods
 * @param {Object} instance
 */
const initMethods = function(instance, methods) {
  const initMethod = function(methodName, method) {
    instance.$data[methodName] = function() {
      return method.apply(instance, arguments);
    }
  }

  for(const method in methods) {
    initMethod(method, methods[method]);
  }
}

/**
 * Sets Up Methods
 * @param {Object} instance
 * @param {Array} methods
 */
const initMethods = function(instance, methods) {
  const initMethod = function(methodName, method) {
    instance.$data[methodName] = method.bind(instance);
  }

  for(const method in methods) {
    initMethod(method, methods[method]);
  }
}

update initMethods