<commit_before>/* 客製化 Sequelize 資料操作 */
class SequelizeModel {
  constructor (model) {
    this.model = model
    this._hookMap = {}
  }

  _genWhereForOpt (where = {}, opt = {}) {
    opt.where = where
    return opt
  }

  _getHook (fnName) {
    const hookMap = this._hookMap
    const hook = hookMap[fnName] = hookMap[fnName] || {}
    hook.pre = hook.pre || []
    hook.post = hook.post || []
    return hook
  }

  async _triggerBy (triggerMethod, fnName, args) {
    const hook = this._getHook(fnName)
    const fns = hook[triggerMethod]
    let gotFalse = false
    for (const key in fns) {
      const fn = fns[key]
      const result = await fn.apply(this, args)
      if (result === false) gotFalse = true<commit_msg>更新 SequelizeMode 轉換 _genWhereForOpt 轉換 offset/limit 為 int<commit_after>/* 客製化 Sequelize 資料操作 */
class SequelizeModel {
  constructor (model) {
    this.model = model
    this._hookMap = {}
  }

  _genWhereForOpt (where = {}, opt = {}) {
    opt.where = where
    if (opt.offset) opt.offset = parseInt(opt.offset, 10)
    if (opt.limit) opt.limit = parseInt(opt.limit, 10)
    return opt
  }

  _getHook (fnName) {
    const hookMap = this._hookMap
    const hook = hookMap[fnName] = hookMap[fnName] || {}
    hook.pre = hook.pre || []
    hook.post = hook.post || []
    return hook
  }

  async _triggerBy (triggerMethod, fnName, args) {
    const hook = this._getHook(fnName)
    const fns = hook[triggerMethod]
    let gotFalse = false
    for (const key in fns) {
      const fn = fns[key]
      const result = await fn.apply(this, args)
      if (result === false) gotFalse = true
{'fraction_non_alphanumeric': 0.12461252324860508, 'fraction_numerical': 0.0024798512089274642, 'mean_word_length': 2.727482678983834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3918960', 'n_tokens_mistral': 565, 'n_tokens_neox': 573, 'n_words': 146}