const number_to_letter = {
  "1": "one",
  "2": "two",
  "3": "three",
  "4": "four",
  "5": "five",
  "6": "six",
  "7": "seven",
  "8": "eight",
  "9": "nine",
  "10": "ten",
  "11": "eleven",
  "12": "twelve",
  "13": "thirteen",
  "14": "fourteen",
  "15": "fifteen",
  "16": "sixeteen",
  "17": "seventeen"
}


function antiFilter(text) {
    // FLAG 1:```
    // numeric ages
    text = text.replace(/([1-9]|1[0-7])[\- ]year[\- ]old/gi, (_, $1) => `${number_to_letter[$1]}-year-old`)
    text = text.replace(/([1-9]|1[0-7])[\- ]years[\- ]old/gi, (_, $1) => `${number_to_letter[$1]}-years-old`)

    // letter ages
    const bad_ages = Object.values(number_to_letter).reduce(
      (acc, cur) => `${acc}|${cur}`
    );
    text = text.replace(new RegExp(`(${bad_ages}) year old`, 'gi'), (_, $1) => `${$1}-year-old`)
    text = text.replace(new RegExp(`(${bad_ages}) years old`, 'gi'), (_, $1) => `${$1}-years-old`)

    text = text.replace(/little girl/gi, "wee lass")
    text = text.replace(/young girl/gi, "young lass")
    text = text.replace(/little boy/gi, "wee lad")
    text = text.replace(/young boy/gi, "young lass")
    text = text.replace(/little child/gi, "wee youth")
    text = text.replace(/young child/gi, "young youth")
    text = text.replace(/ boy /gi, " lad ")
    text = text.replace(/ child /gi, " youth ")
    text = text.replace(/ kid /gi, " youth ")
    text = text.replace(/ infant/gi, " baby")
    text = text.replace(/ preteen/gi, " youth")
    text = text.replace(/ pre-teen/gi, " youth")

    // FLAG 2:
    // These are intentionally words likely to be used in SFW contexts (or as part of SFW words, e.g. super, title, buddy).
    // Feel free to edit as you wish. In some cases, you may with to add additional filters for plural forms etc. - add them before the shorter forms.
    // If you want to live dangerously, you can comment out these filters by wrapping them in /* */ and rely entirely on the age-related filters.
    // If you edit, make sure the spaces are consistent.
    text = text.replace(/ penis/gi," member")
    text = text.replace(/fuck /gi,"bang ")
    text = text.replace(/fucking /gi,"banging")
    text = text.replace(/ dick/gi," rod")
    text = text.replace(/ cock/gi," package")
    text = text.replace(/ ass /gi," bottom ")
    text = text.replace(/ vagina/gi," slit")
    text = text.replace(/ pussy/gi," core")
    text = text.replace(/ cum/gi," come")
    text = text.replace(/ semen/gi," seed")
    text = text.replace(/ breast/gi," tit")
    text = text.replace(/ sex/gi," love")
    text = text.replace(/ suck/gi," sup")
    text = text.replace(/ clit/gi," bud")
    text = text.replace(/masturbate/gi,"rub")
    text = text.replace(/ moan/gi," whine")
    text = text.replace(/ throb/gi," beat")

    return text
}
Edit Report
Pub: 08 May 2021 14:50 UTC
Edit: 08 May 2021 14:58 UTC
Views: 83