(str, desiredLength, truncateChar)
| 184 | } |
| 185 | |
| 186 | function truncate(str, desiredLength, truncateChar) { |
| 187 | truncateChar = truncateChar || '…'; |
| 188 | let lengthOfStr = strlen(str); |
| 189 | if (lengthOfStr <= desiredLength) { |
| 190 | return str; |
| 191 | } |
| 192 | desiredLength -= strlen(truncateChar); |
| 193 | |
| 194 | let ret = truncateWidthWithAnsi(str, desiredLength); |
| 195 | |
| 196 | ret += truncateChar; |
| 197 | |
| 198 | const hrefTag = '\x1B]8;;\x07'; |
| 199 | |
| 200 | if (str.includes(hrefTag) && !ret.includes(hrefTag)) { |
| 201 | ret += hrefTag; |
| 202 | } |
| 203 | |
| 204 | return ret; |
| 205 | } |
| 206 | |
| 207 | function defaultOptions() { |
| 208 | return { |
no test coverage detected
searching dependent graphs…