Widower
Often when working with responsive designs, text will wrap leaving a widowed word on a new line. This JavaScript function replaces the last space with a non breaking space.
Install
npm i @simmo/widower
Usage
import widower from 'widow-killer';
widower('Hello world');
// => Hello\u00A0world
MIT © Mike Simmonds