fmt/bytes `format()` should use non-breaking space between the number and the unit
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 681
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
fmt/bytes `format()` should use non-breaking space between the number and the unit.
https://en.wikipedia.org/wiki/Non-breaking_space#Non-breaking_behavior
> For example, if the text "100 km" will not quite fit at the end of a line, the software may break the line between "100" and "km". Using a non-breaking space between "100" and "km" will prevent this behaviour. This guarantees that the text "100 km" will not be broken—if it does not fit at the end of a line, it is moved in its entirety to the next line. For this reason, many style guides recommend using a non-breaking space between numbers and their associated units.[[4]](https://en.wikipedia.org/wiki/Non-breaking_space#cite_note-5)[[5]](https://en.wikipedia.org/wiki/Non-breaking_space#cite_note-6)
**Describe the solution you'd like**
Use `\xa0` non-breaking space instead of `\x20` space between number and units in fmt/bytes:
```ts
import { format } from '@std/fmt/bytes'
import { assertEquals } from '@std/assert'
assertEquals(format(1e6), '1\xa0MB')
```
**Describe alternatives you've considered**
N/A
Contributor guide
Assessment
This issue has not been assessed yet.