astro-ghostcms/.pnpm-store/v3/files/b2/fcb43ab77e9fa2cd2d58d5b21d0...

1 line
1.2 KiB
Plaintext

{"version":3,"sources":["../src/index.js"],"names":["Wcwidth","require","module","exports","word","breakAtLength","charArr","index","indexOfLastFitChar","fittableLength","length","char","shift","currentLength"],"mappings":";;;;AAAA,IAAIA,UAAUC,QAAQ,SAAR,CAAd;AACAC,OAAOC,OAAP,GAAiB,UAASC,IAAT,EAAcC,aAAd,EAA4B;AAC5C,KAAIC,uCAAcF,IAAd,EAAJ;AACA,KAAIG,QAAQ,CAAZ;AACA,KAAIC,qBAAqB,CAAzB;AACA,KAAIC,iBAAiB,CAArB;AACA,QAAMH,QAAQI,MAAR,GAAiB,CAAvB,EAAyB;AACxB,MAAIC,OAAOL,QAAQM,KAAR,EAAX;AACA,MAAIC,gBAAgBJ,iBAAiBT,QAAQW,IAAR,CAArC;AACA,MAAGE,iBAAiBR,aAApB,EAAkC;AACjCG,wBAAqBD,KAArB;AACAE,oBAAiBI,aAAjB;AACAN;AACA,GAJD,MAKI;AACH;AACA;AACD;AACD;AACA,QAAOC,kBAAP;AACA,CAnBD","file":"index.js","sourcesContent":["var Wcwidth = require('wcwidth');\nmodule.exports = function(word,breakAtLength){\n\tvar charArr = [...word];\n\tvar index = 0;\n\tvar indexOfLastFitChar = 0;\n\tvar fittableLength = 0;\n\twhile(charArr.length > 0){\n\t\tvar char = charArr.shift();\n\t\tvar currentLength = fittableLength + Wcwidth(char);\n\t\tif(currentLength <= breakAtLength){\n\t\t\tindexOfLastFitChar = index;\n\t\t\tfittableLength = currentLength;\n\t\t\tindex++;\n\t\t}\n\t\telse{\n\t\t\tbreak;\n\t\t}\n\t}\n\t//break after this character\n\treturn indexOfLastFitChar;\n};\n"]}