JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 410
  • Score
    100M100P100Q94173F
  • License MIT

Truncate a url so that it doesn't appear so long visually

Package Exports

  • crop-url

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (crop-url) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Crop Url

Build Status Coverage Status Dependency Status NPM version

Truncate a url so that it doesn't appear so long visually

Install

$ npm install crop-url --save

Usage

var cropUrl = require('crop-url');

cropUrl('http://www.foobar.com/abc/def/ghi/index.html', 26);
//=> 'foobar.com/…/index.html'

cropUrl('https://www.foobar.com/abc/def/ghi/jkl/', 26);
//=> 'foobar.com/abc/def/…/jkl/'

cropUrl('http://www.foobar.com/abc/def/ghi/jkl/', 1);
//=> 'foobar.com/…/jkl/'

cropUrl('http://www.foobar.com/search/?q=foo&page=bar', 35);
//=> 'foobar.com/search/?q=foo&page=bar'

cropUrl('http://www.foobar.com/search/?q=foo&page=bar', 20);
//=> 'foobar.com/…/?q=foo…'

cropUrl('http://www.foobar.com/search/?q=foo&page=bar', 12);
//=> 'foobar.com/…/?…'

cropUrl('http://www.foobar.com/foo-bar-foo-bar.html', 12);
//=> 'foobar.com/foo…'

License

The MIT License (MIT)