<commit_before>/**
 * @author weihongyu<<EMAIL>>
 * @version 1.0.0
 */

const helper = require('think-helper');
const Hashids = require('hashids');
const defaultConfig = require('./config.default');

class ThinkHashids {
  /**
   * @param {object} config
   * @param {string} config.salt
   * @param {number} config.minLength
   * @param {string} config.alphabet
   */
  constructor(config) {
    if (helper.isEmpty(config)) {
      config = defaultConfig;
    }
    this.hashids = new Hashids(config.salt, config.minLength, config.alphabet);
  }

  /**
   * Encode ids
   * @param {number|Array} id
   * @return {string}
   */
  encode(id) {
    return this.hashids.encode(id);<commit_msg>refactor:modify the parameter name 'config' to 'option'<commit_after>/**
 * @author weihongyu<<EMAIL>>
 * @version 1.0.0
 */

const helper = require('think-helper');
const Hashids = require('hashids');
const defaultConfig = require('./config.default');

class ThinkHashids {
  /**
   * @param {object} option
   * @param {string} option.salt
   * @param {number} option.minLength
   * @param {string} option.alphabet
   */
  constructor(option) {
    if (helper.isEmpty(option)) {
      option = defaultConfig;
    }
    this.hashids = new Hashids(option.salt, option.minLength, option.alphabet);
  }

  /**
   * Encode ids
   * @param {number|Array} id
   * @return {string}
   */
  encode(id) {
    return this.hashids.encode(id);
{'fraction_non_alphanumeric': 0.15963431786216598, 'fraction_numerical': 0.004219409282700422, 'mean_word_length': 3.3784615384615386, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7169988', 'n_tokens_mistral': 479, 'n_tokens_neox': 468, 'n_words': 101}