<commit_before>/* eslint-disable new-cap */
import _ from 'lodash';

import {Adapter} from '../../';

import Query from './Query';
import Schema from './Schema';

// ## Usage
//
// ### Node.js
//
// With [npm](https://npmjs.com):
//
// ```
// $ npm install --save firenze-adapter-memory
// ```
//
// Now you can require it as follows:
//
// ```js
// var f = require('firenze');
// var Database = f.Database;
// var MemoryAdapter = require('firenze-adapter-memory');
//
// var db = new Database({
//   adapter: MemoryAdapter
// });
// ```
//
// ### Browser
//
//
// Or [Bower](http://bower.io):
//
// ```
// $ bower installl --save firenze-adapter-memory
// ```
//
// Can be loaded in your HTML page as follows:
//
// ```js
// <script src="bower_components/lodash/lodash.min.js"></script>
// <script src="bower_components/async/lib/async.js"></script>
// <script src="bower_components/bluebird/js/browser/bluebird.min.js"></script>
// <script src="bower_components/validator-js/validator.min.js"></script>
//
// <script src="bower_components/firenze/dist/firenze.min.js"></script>
// <script src="bower_components/firenze-adapter-memory/dist/firenze-adapter-memory.min.js"></script>
//
// <script>
// // Memory adapter is availble in `firenze.MemoryAdapter`
// var db = new firenze.Database({
//   adapter: firenze.MemoryAdapter
// });
// </script>
// ```
//
export default class MemoryAdapter extends Adapter {
  constructor(givenOptions = {}) {
    const options = {
      queryClass: Query,
      schemaClass: Schema,
      ...givenOptions
    };

    super(options);

    this.options = options;
    this.data = {};
  }

  getData(path = null) {
    if (!path) {
      return this.data;
    }

    return _.get(this.data, path);
  }

  setData(path = null, value = null) {
    return _.set(this.data, path, value);
  }

  getConnection() {
    return this.data;
  }
}
<commit_msg>remove inline docs.<commit_after>/* eslint-disable new-cap */
import _ from 'lodash';

import {Adapter} from '../../';

import Query from './Query';
import Schema from './Schema';

export default class MemoryAdapter extends Adapter {
  constructor(givenOptions = {}) {
    const options = {
      queryClass: Query,
      schemaClass: Schema,
      ...givenOptions
    };

    super(options);

    this.options = options;
    this.data = {};
  }

  getData(path = null) {
    if (!path) {
      return this.data;
    }

    return _.get(this.data, path);
  }

  setData(path = null, value = null) {
    return _.set(this.data, path, value);
  }

  getConnection() {
    return this.data;
  }
}

{'fraction_non_alphanumeric': 0.1909196740395809, 'fraction_numerical': 0.0, 'mean_word_length': 2.6619318181818183, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '5158622', 'n_tokens_mistral': 868, 'n_tokens_neox': 855, 'n_words': 186}