mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-25 11:24:46 +01:00
1 line
No EOL
1.3 KiB
Text
1 line
No EOL
1.3 KiB
Text
{"version":3,"sources":["../src/main.js"],"names":["wcwidth","require","module","exports","input","breakAtLength","str","toString","charArr","index","indexOfLastFitChar","fittableLength","length","char","shift","currentLength"],"mappings":";;;;AAAA,IAAMA,UAAUC,QAAQ,SAAR,CAAhB;;AAEAC,OAAOC,OAAP,GAAiB,UAASC,KAAT,EAAgBC,aAAhB,EAA+B;;AAE9C,MAAIC,MAAMF,MAAMG,QAAN,EAAV;AACA,MAAMC,uCAAcF,GAAd,EAAN;AACA,MAAIG,QAAQ,CAAZ;AACA,MAAIC,qBAAqB,CAAzB;AACA,MAAIC,iBAAiB,CAArB;;AAEA,SAAMH,QAAQI,MAAR,GAAiB,CAAvB,EAA0B;;AAExB,QAAMC,OAAOL,QAAQM,KAAR,EAAb;AACA,QAAMC,gBAAgBJ,iBAAiBX,QAAQa,IAAR,CAAvC;;AAEA,QAAGE,iBAAiBV,aAApB,EAAmC;AACjCK,2BAAqBD,KAArB;AACAE,uBAAiBI,aAAjB;AACAN;AACD,KAJD,MAIO;AACL;AACD;AAEF;;AAED;AACA,SAAOC,kBAAP;AACD,CAzBD","file":"main.js","sourcesContent":["const wcwidth = require(\"wcwidth\")\n\nmodule.exports = function(input, breakAtLength) {\n\n let str = input.toString()\n const charArr = [...str]\n let index = 0\n let indexOfLastFitChar = 0\n let fittableLength = 0\n\n while(charArr.length > 0) {\n\n const char = charArr.shift()\n const currentLength = fittableLength + wcwidth(char)\n\n if(currentLength <= breakAtLength) {\n indexOfLastFitChar = index\n fittableLength = currentLength\n index++\n } else {\n break\n }\n\n }\n\n //break after this character\n return indexOfLastFitChar\n}\n"]} |