-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difference in output between 2.1.0 and 3.0.1 #24
Comments
The issue can be boiled down to this: var text = 'foo bar'
console.log(JSON.stringify(text)) // => "foo bar"
var r1 = wrap(text, 42)
console.log(JSON.stringify(r1)) // => "foo bar"
var r2 = wrap(text, 42, {trim: false})
console.log(JSON.stringify(r2)) // => "foo bar" I'm not sure from reading the readme if this is the intended result, or if this is a bug. But if it's the intended result, I think |
For reference, this is where the trimming happens: |
@IssueHunt has funded $40.00 to this issue. See it on IssueHunt |
@sindresorhus has rewarded $36.00 to @stroncium. See it on IssueHunt
|
I have the following minimal test case:
Note that srcString has 2 spaces before, between and after the numbers.
Against v2.1.0:
The test prints the same output twice (
trim: false
is ignored). The output is"1 2 "
- both spaces before the '1' were removed. If color terminal is disabled the spaces after the '2' are also removed.Against v3.0.1:
The first line prints with a single space between the numbers, and if color is enabled a single space after the numbers.
The second line prints the original string if color is enabled, if color is disabled it prints an extra space before the string (3 spaces total before the '1').
This was found when trying to update cliui to use v3.0.1. I don't know what the correct behavior should be.
The text was updated successfully, but these errors were encountered: