<commit_before>'use strict';

var assert = require('assert');
var errors = require('muses-errors');
var lodash = require('lodash');
var Service = require('../Service');

/**
 * Muses Service Method Class
 */
class Method {

  /**
   * The default method options.
   *
   * @type {Object}
   */
  static defaultOptions() {
    return {};
  }

  /**
   * Create a Method from a plain object.
   *
   * @param {String} name   The method name.
   * @param {Object} object The input object.
   *
   * @return {Method} The method.
   *
   * @throws {assert.AssertionError} If name is not a string.
   * @throws {assert.AssertionError} If object is not a plain object.
   * @throws {assert.AssertionError} If method.type is not a string or a constructor with Method in the prototype chain.
   * @throws {assert.AssertionError} If method.impl is not a function.
   * @throws {assert.AssertionError} If method.type not valid.
   */
  static fromObject(name, object) {

    // Assert the arguments have the correct structure.
    assert(lodash.isString(name), 'name must be a string');
    assert(lodash.isPlainObject(object), 'object must be a plain object');
    assert(
      lodash.isString(object.type) || object.type === Method || Method.isPrototypeOf(object.type),
      'type must be a string or a constructor with Method in the prototype chain.'
    );

    // Get the method implementation.
    var impl = object.impl;<commit_msg>Fixed docblock comment.<commit_after>'use strict';

var assert = require('assert');
var errors = require('muses-errors');
var lodash = require('lodash');
var Service = require('../Service');

/**
 * Muses Service Method Class
 */
class Method {

  /**
   * The default method options.
   *
   * @type {Object}
   */
  static defaultOptions() {
    return {};
  }

  /**
   * Create a Method from a plain object.
   *
   * @param {String} name   The method name.
   * @param {Object} object The input object.
   *
   * @return {Method} The method.
   *
   * @throws {assert.AssertionError} If name is not a string.
   * @throws {assert.AssertionError} If object is not a plain object.
   * @throws {assert.AssertionError} If object.type is not a string or a constructor with Method in the prototype chain.
   * @throws {assert.AssertionError} If object.impl is not a function.
   * @throws {assert.AssertionError} If object.type not valid.
   */
  static fromObject(name, object) {

    // Assert the arguments have the correct structure.
    assert(lodash.isString(name), 'name must be a string');
    assert(lodash.isPlainObject(object), 'object must be a plain object');
    assert(
      lodash.isString(object.type) || object.type === Method || Method.isPrototypeOf(object.type),
      'type must be a string or a constructor with Method in the prototype chain.'
    );

    // Get the method implementation.
    var impl = object.impl;
{'fraction_non_alphanumeric': 0.12020905923344948, 'fraction_numerical': 0.0, 'mean_word_length': 3.148843930635838, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2091681', 'n_tokens_mistral': 842, 'n_tokens_neox': 828, 'n_words': 299}