<commit_before>// @Compiler-Transpile "true"
// @Compiler-Output "../dist/main.js"
'use strict'
class Proto {
  static Encode(Request) {
    if (Request === null || typeof Request === 'undefined') {
      return "$0\r\n\r\n"
    } else if (typeof Request === 'object' || (typeof Request !== 'string' && typeof Request.length === 'number')) {
      const toReturn = ['*' + Request.length]
      const length = Request.length
      for (let i = 0 ; i < length; ++i ) {
        toReturn[i + 1] = Proto.Encode(Request[i])
      }
      return toReturn.join("\r\n")
    } else if (typeof Request === 'number') {
      return `:${Request}`
    } else {
      if (typeof Request !== 'string') {
        Request = Request.toString('utf8')
      }
      return "$" + Request.length + "\r\n" + Request
    }
  }
  static Decode(Content) {
    let ToReturn = []
    while(true){
      let Entry = Proto.DecodeEntry(Content)
      if(!Entry) break
      ToReturn.push(Entry.value)
      Content = Content.substr(Entry.offset)
      if(!Content.length) break
    }
    return ToReturn
  }
  static *DecodeGen(Content) {
    while(true){
      let Entry = Proto.DecodeEntry(Content)
      if(!Entry) break
      yield Entry.value
      Content = Content.substr(Entry.offset)
      if(!Content.length) break
    }
  }
  static DecodeEntry(Content){
    const Type = Content.readInt8(0)
    const Index = Content.indexOf("\r\n")
    const Count = parseInt(Content.slice(1, Index).toString())

    if(Type === 42){ // *
      let ToReturn = []
      let Offset = Index + 2
      for(var i = 1; i <= Count; ++i){
        let Entry = Proto.DecodeEntry(Content.slice(Offset))
        ToReturn.push(Entry.value)
        Offset += Entry.offset
      }
      return {value: ToReturn, offset: Offset}
    } else if(Type === 36){ // 36 : $
      return (Count === -1) ? {value: null, offset: Index + 2} : {value: Content.substr(Index + 2, Count), offset: Index + Count + 4}
    } else if(Type === 45){ // 45 : -
      throw new Error(Content.substr(1, Index - 1))
    } else if(Type === 43){ // 43 : +
      return {value: Content.substr(1, Index - 1), offset: Index + 2}
    } else if(Type === 58){ // 58 : :
      return {value: parseInt(Content.substr(1, Index - 1)), offset: Index + 2}
    } else throw new Error("Error Decoding Redis Response")
  }
}
module.exports = Proto<commit_msg>:art: Replace all substr with slice<commit_after>// @Compiler-Transpile "true"
// @Compiler-Output "../dist/main.js"
'use strict'
class Proto {
  static Encode(Request) {
    if (Request === null || typeof Request === 'undefined') {
      return "$0\r\n\r\n"
    } else if (typeof Request === 'object' || (typeof Request !== 'string' && typeof Request.length === 'number')) {
      const toReturn = ['*' + Request.length]
      const length = Request.length
      for (let i = 0 ; i < length; ++i ) {
        toReturn[i + 1] = Proto.Encode(Request[i])
      }
      return toReturn.join("\r\n")
    } else if (typeof Request === 'number') {
      return `:${Request}`
    } else {
      if (typeof Request !== 'string') {
        Request = Request.toString('utf8')
      }
      return "$" + Request.length + "\r\n" + Request
    }
  }
  static Decode(Content) {
    let ToReturn = []
    while(true){
      let Entry = Proto.DecodeEntry(Content)
      if(!Entry) break
      ToReturn.push(Entry.value)
      Content = Content.slice(Entry.offset)
      if(!Content.length) break
    }
    return ToReturn
  }
  static *DecodeGen(Content) {
    while(true){
      let Entry = Proto.DecodeEntry(Content)
      if(!Entry) break
      yield Entry.value
      Content = Content.slice(Entry.offset)
      if(!Content.length) break
    }
  }
  static DecodeEntry(Content){
    const Type = Content.readInt8(0)
    const Index = Content.indexOf("\r\n")
    const Count = parseInt(Content.slice(1, Index).toString())

    if(Type === 42){ // *
      let ToReturn = []
      let Offset = Index + 2
      for(var i = 1; i <= Count; ++i){
        let Entry = Proto.DecodeEntry(Content.slice(Offset))
        ToReturn.push(Entry.value)
        Offset += Entry.offset
      }
      return {value: ToReturn, offset: Offset}
    } else if(Type === 36){ // 36 : $
      return (Count === -1) ? {value: null, offset: Index + 2} : {value: Content.slice(Index + 2, Count), offset: Index + Count + 4}
    } else if(Type === 45){ // 45 : -
      throw new Error(Content.slice(1, Index - 1))
    } else if(Type === 43){ // 43 : +
      return {value: Content.slice(1, Index - 1), offset: Index + 2}
    } else if(Type === 58){ // 58 : :
      return {value: parseInt(Content.slice(1, Index - 1)), offset: Index + 2}
    } else throw new Error("Error Decoding Redis Response")
  }
}
module.exports = Proto
{'fraction_non_alphanumeric': 0.16434892541087232, 'fraction_numerical': 0.01643489254108723, 'mean_word_length': 2.4853157121879588, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3566221', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1494, 'n_words': 396}