@simmo/widower

JavaScript function to remove widows from text.

Usage no npm install needed!

<script type="module">
  import simmoWidower from 'https://cdn.skypack.dev/@simmo/widower';
</script>

README

Widower

npm downloads Travis

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

const widower = require('widow-killer')

widower('Hello world')
// => Hello\u00A0world

MIT © Mike Simmonds