function strLength(s, bUnicode255For1) { if(bUnicode255For1) return s.normalize().length else return Array.prototype.reduce.call(s,(pre,cur)=>{ return pre+=cur.codePointAt()>=255?2:1 },0) }