truncate-url

Truncate a URL to a specific length

Usage no npm install needed!

<script type="module">
  import truncateUrl from 'https://cdn.skypack.dev/truncate-url';
</script>

README

truncate-url

Truncate a URL to a specific length

Install

$ npm install truncate-url

Usage

import truncateUrl from 'truncate-url';

truncateUrl('https://sindresorhus.com/foo/bar/baz/faz', 30);
//=> 'https://sindresorhus.com/…/faz'