sindresorhus / cli-truncate

Truncate a string to a specific width in the terminal
MIT License
85 stars 14 forks source link

Add `preferTruncationOnSpace` option #11

Closed ammarbinfaisal1 closed 5 years ago

ammarbinfaisal1 commented 5 years ago

just finding a space within next 3 characters form actual breeaking point. If the string has to be truncated from start then it searches towards left and if the string has to be truncated from end then it searched towards right, so that the length of the truncated string is not more than the columns argument passed.

some changes to the code were done by xo --fix (xo asked for them) like doing destructuring.

Fixes #8

sindresorhus commented 5 years ago

You also need to add it to https://github.com/sindresorhus/cli-truncate/blob/master/index.d.ts

sindresorhus commented 5 years ago

@satyarohith Can you help review?

ammarbinfaisal1 commented 5 years ago

@sindresorhus is it fine now?