sindresorhus/humanize-url

Also do truncation

Aberta

#1 aberto em 10 de set. de 2015

 (5 comentários) (0 reação) (0 responsável)JavaScript (7 forks)user submission
enhancementhelp wanted

Métricas do repositório

Stars
 (252 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

t'would be nice if this also did truncation -- pass another argument with something like {truncate: 40}, and the url would be nicely truncated, with '…' === '\u2026' replacing the truncated text.

Ex.

humanize('http://example.com/a/cool/page/that-is-really-deeply/nested/', {truncate: 20}') -> 'example.com/…/nested'

humanize('http://example.com/a/cool/page/that-is-really-deeply/nested/', {truncate: 24}') -> 'example.com/a/…/nested'

humanize('http://example.com/a/cool/page/that-is-really-deeply/nested/', {truncate: 30}') -> 'example.com/a/cool/…/nested'

Or this could also be a separate module. module-requests ahoy?

Guia do colaborador