Skip to content

Commit c1fb59c

Browse files
TeeTurbo87
Tee
authored andcommitted
Emoji Length Calculation Fix (cli-table#92)
* fixed emoji length calculations * uninstall string-width module * updated yarn.lock * reverted object assign to 4.1.0
1 parent 0b29bf9 commit c1fb59c

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"object-assign": "^4.1.0",
17-
"string-width": "^3.0.0"
17+
"stringz": "^1.0.0"
1818
},
1919
"devDependencies": {
2020
"ansi-256-colors": "^1.1.0",

src/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const objectAssign = require('object-assign');
2-
const stringWidth = require('string-width');
2+
const stringz = require('stringz');
33

44
function codeRegex(capture) {
55
return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
@@ -10,7 +10,7 @@ function strlen(str) {
1010
let stripped = ('' + str).replace(code, '');
1111
let split = stripped.split('\n');
1212
return split.reduce(function(memo, s) {
13-
return stringWidth(s) > memo ? stringWidth(s) : memo;
13+
return stringz.length(s) > memo ? stringz.length(s) : memo;
1414
}, 0);
1515
}
1616

yarn.lock

+13-15
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,6 @@ ecc-jsbn@~0.1.1:
11611161
dependencies:
11621162
jsbn "~0.1.0"
11631163

1164-
emoji-regex@^7.0.1:
1165-
version "7.0.1"
1166-
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.1.tgz#5a132b28ebf84a289ba692862f7d4206ebcd32d0"
1167-
integrity sha512-cjx7oFbFIyZMpmWaEBnKeJXWAVzjXwK6yHiz/5X73A2Ww4pnabw+4ZaA/MxLroIQQrB3dL6XzEz8P3aZsSdj8Q==
1168-
11691164
encoding@^0.1.11:
11701165
version "0.1.12"
11711166
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
@@ -4100,15 +4095,6 @@ string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1:
41004095
is-fullwidth-code-point "^2.0.0"
41014096
strip-ansi "^4.0.0"
41024097

4103-
string-width@^3.0.0:
4104-
version "3.1.0"
4105-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961"
4106-
integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==
4107-
dependencies:
4108-
emoji-regex "^7.0.1"
4109-
is-fullwidth-code-point "^2.0.0"
4110-
strip-ansi "^5.1.0"
4111-
41124098
string.prototype.padend@^3.0.0:
41134099
version "3.0.0"
41144100
resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0"
@@ -4125,6 +4111,13 @@ string_decoder@~1.1.1:
41254111
dependencies:
41264112
safe-buffer "~5.1.0"
41274113

4114+
stringz@^1.0.0:
4115+
version "1.0.0"
4116+
resolved "https://registry.yarnpkg.com/stringz/-/stringz-1.0.0.tgz#d2acba994e4ce3c725ee15c86fff4281280d2025"
4117+
integrity sha512-oaqFaIAmw1MJmdPNiBqocHHrC0VzJTL3CI1z5uXm3NQSE3AyDU152ZPTSJSOKk+9z1Cm3LZzgLFjCTb8SXZvag==
4118+
dependencies:
4119+
unicode-astral-regex "^1.0.1"
4120+
41284121
strip-ansi@^3.0.0, strip-ansi@^3.0.1:
41294122
version "3.0.1"
41304123
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
@@ -4139,7 +4132,7 @@ strip-ansi@^4.0.0:
41394132
dependencies:
41404133
ansi-regex "^3.0.0"
41414134

4142-
strip-ansi@^5.0.0, strip-ansi@^5.1.0:
4135+
strip-ansi@^5.0.0:
41434136
version "5.1.0"
41444137
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.1.0.tgz#55aaa54e33b4c0649a7338a43437b1887d153ec4"
41454138
integrity sha512-TjxrkPONqO2Z8QDCpeE2j6n0M6EwxzyDgzEeGp+FbdvaJAt//ClYi6W5my+3ROlC/hZX2KACUwDfK49Ka5eDvg==
@@ -4343,6 +4336,11 @@ uglify-js@^3.1.4:
43434336
commander "~2.17.1"
43444337
source-map "~0.6.1"
43454338

4339+
unicode-astral-regex@^1.0.1:
4340+
version "1.0.1"
4341+
resolved "https://registry.yarnpkg.com/unicode-astral-regex/-/unicode-astral-regex-1.0.1.tgz#2cab8529480646f9614ddbc7b62158ad05123feb"
4342+
integrity sha512-UP6cmDeiWi8bMDmkyXLRsDuVPTvPjh8Wsz+pHu1VkGgTBl4pUceYAdHXY0cdc6Q3+Z2q7QMzi/0E7L/S/yOvFw==
4343+
43464344
union-value@^1.0.0:
43474345
version "1.0.0"
43484346
resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4"

0 commit comments

Comments
 (0)