{"id":22021548,"url":"https://github.com/lamansky/remove-suffix","last_synced_at":"2026-04-10T15:53:39.901Z","repository":{"id":57353355,"uuid":"84050633","full_name":"lamansky/remove-suffix","owner":"lamansky","description":"[Node.js] Removes a string from the end of another string.","archived":false,"fork":false,"pushed_at":"2018-02-03T21:22:46.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T22:42:16.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/lamansky.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-06T08:49:52.000Z","updated_at":"2018-12-12T08:30:37.000Z","dependencies_parsed_at":"2022-09-14T19:20:30.654Z","dependency_job_id":null,"html_url":"https://github.com/lamansky/remove-suffix","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fremove-suffix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fremove-suffix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fremove-suffix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fremove-suffix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamansky","download_url":"https://codeload.github.com/lamansky/remove-suffix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245085034,"owners_count":20558324,"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":[],"created_at":"2024-11-30T06:12:45.914Z","updated_at":"2025-12-30T23:35:09.836Z","avatar_url":"https://github.com/lamansky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# remove-suffix\n\nRemoves a string from the end of another string.\n\n## Installation\n\nRequires [Node.js](https://nodejs.org/) 6.0.0 or above.\n\n```bash\nnpm i remove-suffix\n```\n\n## API\n\nThe module exports a single function.\n\n### Parameters\n\n1. Bindable: `subject` (string): The string that may or may not have a suffix to be removed.\n2. `...suffixes` (one or more of: string or Array of strings): The first suffix found will be removed. Longer suffixes are checked first.\n\n### Return Value\n\nA two-element Array:\n\n1. The string without its suffix, or the original string if no suffix was found.\n2. The suffix if one was found; otherwise an empty string.\n\n## Example\n\n```javascript\nconst removeSuffix = require('remove-suffix')\n\nconst subject = 'abcdef'\nlet result, suffix\n\n// Removes the suffix\n[result] = removeSuffix(subject, 'def')\nresult // 'abc'\n\n// Returns suffix as second element, or returns an empty string if not found\n[result, suffix] = removeSuffix(subject, 'xyz')\nresult // 'abcdef'\nsuffix // ''\n\n// Removes the first suffix found. Longer suffixes are checked first.\n// Suffixes can be given as an arguments list or in an array.\n[result, suffix] = removeSuffix(subject, 'xyz', 'def', 'bc')\nresult // 'abc'\nsuffix // 'def'\n\n// Supports the bind operator\nsubject::removeSuffix('def') // ['abc', 'def']\n```\n\n## Related\n\n* [remove-prefix](https://github.com/lamansky/remove-prefix): Removes a string from the beginning of another string.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fremove-suffix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamansky%2Fremove-suffix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fremove-suffix/lists"}