sindresorhus/humanize-url

Also do truncation

开放

#1 创建于 2015年9月10日

 (5 条评论) (0 个反应) (0 位负责人)JavaScript (7 个派生)user submission
enhancementhelp wanted

仓库指标

星标
 (252 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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?

贡献者指南