<commit_before>/**
 * Functions to manipulate refinement lists
 *
 * The RefinementList is not formally defined through a prototype but is based
 * on a specific structure.
 *
 * @module SearchParameters.refinementList
 *
 * @typedef {string[]} SearchParameters.refinementList.Refinements
 * @typedef {Object.<string, Refinements>} SearchParameters.refinementList.RefinementList
 */

"use strict";
var extend = require( "../functions/extend" );

var isUndefined = require( "lodash/lang/isUndefined" );
var isString = require( "lodash/lang/isString" );
var isFunction = require( "lodash/lang/isFunction" );
var isEmpty = require( "lodash/lang/isEmpty" );

var reduce = require( "lodash/collection/reduce" );
var filter = require( "lodash/collection/filter" );
var omit = require( "lodash/object/omit" );

var lib = {
  /**
   * Adds a refinement to a RefinementList
   * @param {RefinementList} refinementList the initial list
   * @param {string} attribute the attribute to refine
   * @param {string} value the value of the refinement
   * @return {RefinementList} a new and updated prefinement list
   */
  addRefinement : function addRefinement( refinementList, attribute, value ) {
    if( lib.isRefined( refinementList, attribute, value ) ) {
      return refinementList;<commit_msg>Change type in RefinementList for consistency<commit_after>/**
 * Functions to manipulate refinement lists
 *
 * The RefinementList is not formally defined through a prototype but is based
 * on a specific structure.
 *
 * @module SearchParameters.refinementList
 *
 * @typedef {string[]} SearchParameters.refinementList.Refinements
 * @typedef {Object.<string, SearchParameters.refinementList.Refinements>} SearchParameters.refinementList.RefinementList
 */

"use strict";
var extend = require( "../functions/extend" );

var isUndefined = require( "lodash/lang/isUndefined" );
var isString = require( "lodash/lang/isString" );
var isFunction = require( "lodash/lang/isFunction" );
var isEmpty = require( "lodash/lang/isEmpty" );

var reduce = require( "lodash/collection/reduce" );
var filter = require( "lodash/collection/filter" );
var omit = require( "lodash/object/omit" );

var lib = {
  /**
   * Adds a refinement to a RefinementList
   * @param {RefinementList} refinementList the initial list
   * @param {string} attribute the attribute to refine
   * @param {string} value the value of the refinement
   * @return {RefinementList} a new and updated prefinement list
   */
  addRefinement : function addRefinement( refinementList, attribute, value ) {
    if( lib.isRefined( refinementList, attribute, value ) ) {
      return refinementList;
{'fraction_non_alphanumeric': 0.10984848484848485, 'fraction_numerical': 0.0, 'mean_word_length': 4.6191489361702125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2634504', 'n_tokens_mistral': 783, 'n_tokens_neox': 735, 'n_words': 234}