diff --git a/package.json b/package.json index d618bc2..a2fc65e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "object-assign": "^4.1.0", - "stringz": "^1.0.0" + "string-width": "^3.0.0" }, "devDependencies": { "ansi-256-colors": "^1.1.0", @@ -76,7 +76,7 @@ { "displayName": "test", "testMatch": [ - "**/test/**/*-test(s)?.js" + "/test/*.js" ] }, { diff --git a/src/utils.js b/src/utils.js index 8df9e68..c914955 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,5 +1,5 @@ const objectAssign = require('object-assign'); -const stringz = require('stringz'); +const stringWidth = require('string-width'); function codeRegex(capture) { return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g; @@ -10,7 +10,7 @@ function strlen(str) { let stripped = ('' + str).replace(code, ''); let split = stripped.split('\n'); return split.reduce(function(memo, s) { - return stringz.length(s) > memo ? stringz.length(s) : memo; + return stringWidth(s) > memo ? stringWidth(s) : memo; }, 0); } diff --git a/yarn.lock b/yarn.lock index c43325f..9d40b6c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1206,6 +1206,11 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" +emoji-regex@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.1.tgz#5a132b28ebf84a289ba692862f7d4206ebcd32d0" + integrity sha512-cjx7oFbFIyZMpmWaEBnKeJXWAVzjXwK6yHiz/5X73A2Ww4pnabw+4ZaA/MxLroIQQrB3dL6XzEz8P3aZsSdj8Q== + encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" @@ -4299,6 +4304,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string-width@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + string.prototype.padend@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0" @@ -4315,13 +4329,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -stringz@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stringz/-/stringz-1.0.0.tgz#d2acba994e4ce3c725ee15c86fff4281280d2025" - integrity sha512-oaqFaIAmw1MJmdPNiBqocHHrC0VzJTL3CI1z5uXm3NQSE3AyDU152ZPTSJSOKk+9z1Cm3LZzgLFjCTb8SXZvag== - dependencies: - unicode-astral-regex "^1.0.1" - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -4336,7 +4343,7 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0: +strip-ansi@^5.0.0, strip-ansi@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.1.0.tgz#55aaa54e33b4c0649a7338a43437b1887d153ec4" integrity sha512-TjxrkPONqO2Z8QDCpeE2j6n0M6EwxzyDgzEeGp+FbdvaJAt//ClYi6W5my+3ROlC/hZX2KACUwDfK49Ka5eDvg== @@ -4553,11 +4560,6 @@ uglify-js@^3.1.4: commander "~2.17.1" source-map "~0.6.1" -unicode-astral-regex@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/unicode-astral-regex/-/unicode-astral-regex-1.0.1.tgz#2cab8529480646f9614ddbc7b62158ad05123feb" - integrity sha512-UP6cmDeiWi8bMDmkyXLRsDuVPTvPjh8Wsz+pHu1VkGgTBl4pUceYAdHXY0cdc6Q3+Z2q7QMzi/0E7L/S/yOvFw== - union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4"