<commit_before>module.exports = function (kuzzle) {
  var
    _ = require('lodash'),
    async = require('async'),
    q = require('q'),
    Profile = require('../security/profile'),
    BadRequestError = require('../../errors/badRequestError'),
    NotFoundError = require('../../errors/notFoundError'),
    Repository = require('./repository');

  var extractRoleIds = function (roles) {
    return roles.map(role => {
      if (typeof role === 'string') {
        return role;
      }

      return role._id;
    });
  };

  function ProfileRepository () {
    this.profiles = {};
  }

  ProfileRepository.prototype = new Repository(kuzzle, {
    index: kuzzle.config.internalIndex,
    collection: 'profiles',
    ObjectConstructor: Profile,
    cacheEngine: kuzzle.services.list.userCache
  });

  /**
   * Loads a Profile object given its id.<commit_msg>eslint<commit_after>module.exports = function (kuzzle) {
  var
    _ = require('lodash'),
    q = require('q'),
    Profile = require('../security/profile'),
    BadRequestError = require('../../errors/badRequestError'),
    NotFoundError = require('../../errors/notFoundError'),
    Repository = require('./repository');

  var extractRoleIds = function (roles) {
    return roles.map(role => {
      if (typeof role === 'string') {
        return role;
      }

      return role._id;
    });
  };

  function ProfileRepository () {
    this.profiles = {};
  }

  ProfileRepository.prototype = new Repository(kuzzle, {
    index: kuzzle.config.internalIndex,
    collection: 'profiles',
    ObjectConstructor: Profile,
    cacheEngine: kuzzle.services.list.userCache
  });

  /**
   * Loads a Profile object given its id.
{'fraction_non_alphanumeric': 0.1532976827094474, 'fraction_numerical': 0.0, 'mean_word_length': 2.916279069767442, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2364067', 'n_tokens_mistral': 499, 'n_tokens_neox': 474, 'n_words': 101}