<commit_before>import events from 'events'

// Local modules.
import memoryAdapter from './adapter/adapters/memory'
import AdapterSingleton from './adapter/singleton'
import SerializerSingleton from './serializer/singleton'
import defineArguments from './common/define_arguments'
import validate from './record_type/validate'
import ensureTypes from './record_type/ensure_types'
import dispatch, * as middlewares from './dispatch'

// Static exports.
import Adapter from './adapter'
import Serializer from './serializer'
import * as errors from './common/errors'
import * as methods from './common/methods'
import change from './common/change'


/**
 * This is the default export of the `fortune` module. The Fortune class
 * subclasses the built-in `EventEmitter` class, and it has a few static
 * properties attached to it that may be useful to access:
 *
 * - `Adapter`: abstract base class for the Adapter.
 * - `adapters`: included adapters, currently defaulting to NeDB for the
 * server, and IndexedDB for the browser (with Web Storage as a fallback).
 * - `Serializer`: abstract base class for the Serializer.
 * - `serializers`: included serializers, currently Micro API and JSON API.
 * - `net`: network protocol helpers, currently HTTP and WebSocket.
 * - `errors`: custom typed errors, useful for throwing errors in transform
 * functions.
 * - `methods`: a hash that maps strings to symbols. Available are: `find`,
 * `create`, `update`, and `delete`.
 * - `change`: this is the symbol for the event that is emitted when a change
 * is done. The callback function receives an object keyed by method symbols.
 *
 * Note: in the browser version, `serializers` and `net` are omitted.
 */
export default class Fortune extends events.EventEmitter {

  /**
   * Create a new instance. The options object may be as follows:
   *
   * ```js
   * {
   *   // Adapter configuration. Default: NeDB
   *   adapter: {
   *     // Must be a class that extends `Fortune.Adapter`, or a function
   *     // that accepts the Adapter class and returns a subclass. Required.
   *     type: Adapter => { ... },
   *
   *     // An options object that is specific to the adapter. Optional.
   *     options: { ... }
   *   },
   *
   *   // Serializers ordered by priority. Default: Micro API, JSON API
   *   serializers: [{
   *     // Must be a class that extends `Fortune.Serializer`, or a function
   *     // that accepts the Serializer class and returns a subclass. Required.
   *     type: Serializer => { ... },
   *
   *     // An options object that is specific to the serializer. Optional.
   *     options: { ... }
   *   }]
   * }
   * ```<commit_msg>update documentation<commit_after>import events from 'events'

// Local modules.
import memoryAdapter from './adapter/adapters/memory'
import AdapterSingleton from './adapter/singleton'
import SerializerSingleton from './serializer/singleton'
import defineArguments from './common/define_arguments'
import validate from './record_type/validate'
import ensureTypes from './record_type/ensure_types'
import dispatch, * as middlewares from './dispatch'

// Static exports.
import Adapter from './adapter'
import Serializer from './serializer'
import * as errors from './common/errors'
import * as methods from './common/methods'
import change from './common/change'


/**
 * This is the default export of the `fortune` module. The Fortune class
 * subclasses the built-in `EventEmitter` class, and it has a few static
 * properties attached to it that may be useful to access:
 *
 * - `Adapter`: abstract base class for the Adapter.
 * - `adapters`: included adapters, defaults to memory adapter. Note that the
 * browser build also includes `indexedDB` and `webStorage` adapters.
 * - `Serializer`: abstract base class for the Serializer.
 * - `serializers`: included serializers, currently Micro API and JSON API.
 * - `net`: network protocol helpers, currently HTTP and WebSocket.
 * - `errors`: custom typed errors, useful for throwing errors in transform
 * functions.
 * - `methods`: a hash that maps strings to symbols. Available are: `find`,
 * `create`, `update`, and `delete`.
 * - `change`: this is the symbol for the event that is emitted when a change
 * is done. The callback function receives an object keyed by method symbols.
 *
 * Note: in the browser version, `serializers` and `net` are omitted.
 */
export default class Fortune extends events.EventEmitter {

  /**
   * Create a new instance. The options object may be as follows:
   *
   * ```js
   * {
   *   // Adapter configuration. Default: `memoryAdapter`
   *   adapter: {
   *     // Must be a class that extends `Fortune.Adapter`, or a function
   *     // that accepts the Adapter class and returns a subclass. Required.
   *     type: Adapter => { ... },
   *
   *     // An options object that is specific to the adapter. Optional.
   *     options: { ... }
   *   },
   *
   *   // Serializers ordered by priority. Default: Micro API, JSON API
   *   serializers: [{
   *     // Must be a class that extends `Fortune.Serializer`, or a function
   *     // that accepts the Serializer class and returns a subclass. Required.
   *     type: Serializer => { ... },
   *
   *     // An options object that is specific to the serializer. Optional.
   *     options: { ... }
   *   }]
   * }
   * ```
{'fraction_non_alphanumeric': 0.10877719429857464, 'fraction_numerical': 0.0, 'mean_word_length': 3.0834609494640124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3247117', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1414, 'n_words': 610}