owoify-js-ant
Version:
Fork of owoify-js by mohan-cao without the console logging
3 lines (2 loc) • 4.21 kB
JavaScript
;var e=function(){function e(e){this.word=e.trim(),this.replacedWords=new Set}var r=e.prototype;return r.replace=function(e,r,n){if(void 0===n&&(n=!1),!n&&function(e,r,n){return Array.from(n).some((function(n){return n.replace(e,r)!==n}))}(e,r,this.replacedWords))return this;var t=this.word.replace(e,r).trim(),u=this.word.match(e),c=null!==u?Array.from(u).map((function(e){return e.replace(e,r)})):[];if(t!==this.word){var o=c,a=Array.isArray(o),l=0;for(o=a?o:o[Symbol.iterator]();;){var i;if(a){if(l>=o.length)break;i=o[l++]}else{if((l=o.next()).done)break;i=l.value}this.replacedWords.add(i)}this.word=t}return this},r.toString=function(){return this.word},e}(),r=["(・`ω´・)",";;w;;","owo","UwU",">w<","^w^","(* ^ ω ^)","(⌒ω⌒)","ヽ(*・ω・)ノ","(o´∀`o)","(o・ω・o)","\(^▽^)/"],n=[function(e){return e.replace(/([Ff])uc/g,"$1wuc")},function(e){return e.replace(/([Mm])om/g,"$1wom")},function(e){return e.replace(/\b([Tt])ime\b/g,"$1im")},function(e){return e.replace(/([Mm])e/g,"$1we")},function(e){return e.replace(/n([aeiou])/g,"ny$1").replace(/N([aeiou])/g,"Ny$1").replace(/N([AEIOU])/g,"NY$1")},function(e){return e.replace(/([Oo])ver/g,"$1wor")},function(e){return e.replace(/ove/g,"uv").replace(/OVE/g,"UV")},function(e){return e.replace(/\b(ha|hah|heh|hehe)+\b/g,"hehe xD")},function(e){return e.replace(/\b([Tt])he\b/g,"$1eh")},function(e){return e.replace(/\bYou\b/g,"U").replace(/\byou\b/g,"u")},function(e){return e.replace(/Read/g,"Wead").replace(/read/g,"wead")},function(e){return e.replace(/([Ww])orse/g,"$1ose")}],t=[function(e){return e.replace(/o/g,(function(){return Math.round(Math.random())?"owo":"o"}))},function(e){return e.replace(/ew/g,"uwu")},function(e){return e.replace(/([Hh])ey/g,"$1ay")},function(e){return e.replace(/Dead/g,"Ded").replace(/dead/g,"ded")},function(e){return e.replace(/n[aeiou]*t/g,"nd")}],u=[function(e){return e.replace(/[({<]/g,"。・:*:・゚★,。・:*:・゚☆").replace(/[)}>]/g,"☆゚・:*:・。,★゚・:*:・。")},function(e){return e.replace(/[.,](?![0-9])/g,(function(){return" "+r[Math.floor(Math.random()*r.length)]})).replace(/[!;]+/g,(function(){return" "+r[Math.floor(Math.random()*r.length)]}))},function(e){return e.replace(/that/g,"dat").replace(/That/g,"Dat")},function(e){return e.replace(/[Tt]h(?![Ee])/g,"f").replace(/TH(?!E)/g,"F")},function(e){return e.replace(/le$/g,"wal")},function(e){return e.replace(/ve/g,"we").replace(/Ve/g,"We")},function(e){return e.replace(/ry/g,"wwy")},function(e){return e.replace(/(?:r|l)/g,"w").replace(/(?:R|L)/g,"W")}],c=[function(e){return e.replace(/ll/g,"ww")},function(e){return e.replace(/[aeiur]l$/g,"wl").replace(/[AEIUR]([lL])$/g,"W$1")},function(e){return e.replace(/([Oo])ld/g,"$1wld").replace(/OLD/g,"OWLD")},function(e){return e.replace(/([Oo])l/g,"$1wl").replace(/OL/g,"OWL")},function(e){return e.replace(/[lr]o/g,"wo").replace(/[LR]([oO])/g,"W$1")},function(e){return e.replace(/([bcdfghjkmnpqstxyz])o/g,"$1wo").replace(/([BCDFGHJKMNPQSTXYZ])([oO])/g,(function(e,r,n){return r+(n.toUpperCase()===n?"W":"w")+n}))},function(e){return e.replace(/[vw]le/g,"wal")},function(e){return e.replace(/([Ff])i/g,"$1wi").replace(/FI/g,"FWI")},function(e){return e.replace(/([Vv])er/g,"wer")},function(e){return e.replace(/([Pp])oi/g,"$1woi")},function(e){return e.replace(/([DdFfGgHhJjPpQqRrSsTtXxYyZz])le$/g,"$1wal")},function(e){return e.replace(/([BbCcDdFfGgKkPpQqSsTtWwXxZz])r/g,"$1w")},function(e){return e.replace(/ly/g,"wy").replace(/Ly/g,"Wy")},function(e){return e.replace(/([Pp])le/g,"$1we")},function(e){return e.replace(/nr/g,"nw").replace(/NR/g,"NW")}];exports.default=function(r,o){void 0===o&&(o="owo");var a=r.split(/[^\s]+/g),l=r.split(/\s+/g).map((function(r){return new e(r)}));return function(e,r){for(var n=[],t=e,u=r,c=null;t.length>0;)n.push(t.shift()),c=t,t=u,u=c;return u.length>0&&n.push.apply(n,u),n}(a,l=l.map((function(e){switch(e=n.reduce((function(e,r){return r(e)}),e),o){case"uvu":e=t.reduce((function(e,r){return r(e)}),e);case"uwu":e=u.reduce((function(e,r){return r(e)}),e);case"owo":e=c.reduce((function(e,r){return r(e)}),e)}return e}))).join("")};
//# sourceMappingURL=owoify-js-ant.cjs.production.min.js.map