all files / lib/mixins/ normalizer.js

100% Statements 11/11
75% Branches 3/4
100% Functions 3/3
100% Lines 11/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20   28× 28×   28× 158× 65× 106× 106×         28×      
var _ = require('lodash');
var getArguments = require('feathers-commons').getArguments;
 
module.exports = function (service) {
  Eif (typeof service.mixin === 'function') {
    var mixin = {};
 
    _.each(this.methods, function(method) {
      if(typeof service[method] === 'function') {
        mixin[method] = function() {
          var args = getArguments(method, arguments);
          return this._super.apply(this, args);
        };
      }
    });
 
    service.mixin(mixin);
  }
};