lib/Service.js
/**
   * Set the service's methods.
   *
   * @param {Object|Array} methods The service methods as a hash object or an array of Method instances.
   *
   * @throws {assert.AssertionError} If methods is not a hash object or an array of Method instances.
   */
Set the service's methods.
@param {Object|Array} methods The service methods as a hash object or an array of Method instances.

@throws {assert.AssertionError} If methods is not a hash object or an array of Method instances.
Set the service ' s methods . @param { Object|Array } methods The service methods as a hash object or an array of Method instances . @throws { assert . AssertionError } If methods is not a hash object or an array of Method instances .
set methods(methods) {
    if (lodash.isArray(methods)) {
      if (~(methods.map((method) => method instanceof this.types.Method).indexOf(false))) {
        throw new assert.AssertionError({ message: 'methods array must contain only Method instances' });
      }
    }
    else {
      assert(lodash.isPlainObject(methods), 'methods object must be an array of Method instances or plain object');
      var objects = methods;
      methods = [];
      lodash.forOwn(objects, (object, name) => {
        methods.push(this.types.Method.fromObject(name, object));
      });
    }
    this._methods = [];
    methods.forEach((method) => this.add(method));
  }
set methods ( methods ) { if ( lodash . isArray ( methods ) ) { if ( ~ ( methods . map ( ( method ) => method instanceof this . types . Method ) . indexOf ( false ) ) ) { throw new assert . AssertionError ( { message : 'methods array must contain only Method instances' } ) ; } } else { assert ( lodash . isPlainObject ( methods ) , 'methods object must be an array of Method instances or plain object' ) ; var objects = methods ; methods = [ ] ; lodash . forOwn ( objects , ( object , name ) => { methods . push ( this . types . Method . fromObject ( name , object ) ) ; } ) ; } this . _methods = [ ] ; methods . forEach ( ( method ) => this . add ( method ) ) ; }
Set the service's methods.
Set the service ' s methods .
// Assert methods is an array of Method instances or a hash object. // Convert hash object to Method instances. // Convert hash object to array of Methods. // Reset methods. // Add the methods.