js-beautify
js-beautify copied to clipboard
Line wrap breaks signed numbers
Description
At the end of the 1st line in the Actual Output we see a stray hyphen which belongs to the Number wrapped to the line after.
Input
[-0.49673205000000004, -0.49038462, -0.006536000000000042, -0.336538, 0.49673199999999995, -0.5, 0.40522899999999995, 0, 0.11764699999999995, -0.05769200000000002, -0.006536000000000042, 0.5, -0.03268000000000004, -0.19230799999999998, -0.42483660000000006, 0]
Expected Output
[-0.49673205000000004, -0.49038462, -0.006536000000000042, -0.336538, 0.49673199999999995, -0.5, 0.40522899999999995, 0, 0.11764699999999995,
-0.05769200000000002, -0.006536000000000042, 0.5, -0.03268000000000004, -0.19230799999999998, -0.42483660000000006, 0
]
Actual Output
[-0.49673205000000004, -0.49038462, -0.006536000000000042, -0.336538, 0.49673199999999995, -0.5, 0.40522899999999995, 0, 0.11764699999999995, -
0.05769200000000002, -0.006536000000000042, 0.5, -0.03268000000000004, -0.19230799999999998, -0.42483660000000006, 0
]
Steps to Reproduce
input = JSON.stringify([-0.49673205000000004, -0.49038462, -0.006536000000000042, -0.336538, 0.49673199999999995, -0.5, 0.40522899999999995, 0, 0.11764699999999995, -0.05769200000000002, -0.006536000000000042, 0.5, -0.03268000000000004, -0.19230799999999998, -0.42483660000000006, 0]);
console.log(js_beautify(input, { wrap_line_length: 160 }));
Environment
OS: Win10 Node: 20.7.0 js-beautify: 1.15.1 from cdnjs
Settings
{
"wrap_line_length": 160
}