{"id":19788901,"url":"https://github.com/williambelle/crop-url","last_synced_at":"2025-05-01T00:31:32.387Z","repository":{"id":57159052,"uuid":"82842670","full_name":"williambelle/crop-url","owner":"williambelle","description":"Truncate a url so that it doesn't appear so long visually.","archived":false,"fork":false,"pushed_at":"2021-06-22T18:06:38.000Z","size":38,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-31T05:50:06.627Z","etag":null,"topics":["crop","npm-package","truncate","uri","url"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/crop-url","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/williambelle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-22T19:11:07.000Z","updated_at":"2022-03-15T08:05:47.000Z","dependencies_parsed_at":"2022-09-07T20:11:48.634Z","dependency_job_id":null,"html_url":"https://github.com/williambelle/crop-url","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williambelle%2Fcrop-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williambelle%2Fcrop-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williambelle%2Fcrop-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williambelle%2Fcrop-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williambelle","download_url":"https://codeload.github.com/williambelle/crop-url/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224230146,"owners_count":17277287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crop","npm-package","truncate","uri","url"],"created_at":"2024-11-12T06:29:15.373Z","updated_at":"2024-11-12T06:29:16.019Z","avatar_url":"https://github.com/williambelle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"crop-url\n========\n\n[![Build Status][github-actions-image]][github-actions-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n[![NPM version][npm-image]][npm-url]\n\nTruncate a url so that it doesn't appear so long visually.\n\nInstall\n-------\n\n```bash\nnpm i crop-url\n```\n\nUsage\n-----\n\n```js\nconst cropUrl = require('crop-url');\n\nlet url = cropUrl('http://www.foobar.com/abc/def/ghi/index.html', 26);\nconsole.log(url) //=\u003e 'foobar.com/…/index.html'\n\nurl = cropUrl('https://www.foobar.com/abc/def/ghi/jkl/', 26);\nconsole.log(url) //=\u003e 'foobar.com/abc/def/…/jkl/'\n\nurl = cropUrl('http://www.foobar.com/abc/def/ghi/jkl/', 1);\nconsole.log(url) //=\u003e 'foobar.com/…/jkl/'\n\nurl = cropUrl('http://www.foobar.com/search/?q=foo\u0026page=bar', 35);\nconsole.log(url) //=\u003e 'foobar.com/search/?q=foo\u0026page=bar'\n\nurl = cropUrl('http://www.foobar.com/search/?q=foo\u0026page=bar', 20);\nconsole.log(url) //=\u003e 'foobar.com/…/?q=foo…'\n\nurl = cropUrl('http://www.foobar.com/search/?q=foo\u0026page=bar', 12);\nconsole.log(url) //=\u003e 'foobar.com/…/?…'\n\nurl = cropUrl('http://www.foobar.com/foo-bar-foo-bar.html', 12);\nconsole.log(url) //=\u003e 'foobar.com/foo…'\n```\n\nContributing\n------------\n\nContributions are always welcome.\n\nSee [Contributing](CONTRIBUTING.md).\n\nDeveloper\n---------\n\n* [William Belle](https://github.com/williambelle)\n\nLicense\n-------\n\nThe MIT License (MIT)\n\n[npm-image]: https://img.shields.io/npm/v/crop-url.svg\n[npm-url]: https://www.npmjs.com/package/crop-url\n[github-actions-image]: https://github.com/williambelle/crop-url/workflows/Build/badge.svg\n[github-actions-url]: https://github.com/williambelle/crop-url/actions\n[coveralls-image]: https://coveralls.io/repos/github/williambelle/crop-url/badge.svg\n[coveralls-url]: https://coveralls.io/github/williambelle/crop-url\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliambelle%2Fcrop-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliambelle%2Fcrop-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliambelle%2Fcrop-url/lists"}