{"id":24096347,"url":"https://github.com/nihilor/trimfandango","last_synced_at":"2026-06-09T18:31:45.379Z","repository":{"id":57379943,"uuid":"422828674","full_name":"nihilor/trimfandango","owner":"nihilor","description":"Advanced trimming of strings by providing lists of characters or full strings.","archived":false,"fork":false,"pushed_at":"2022-01-14T09:05:39.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-21T07:25:08.060Z","etag":null,"topics":["adventure","javascript","pure","trim","trimming"],"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/nihilor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2021-10-30T08:44:15.000Z","updated_at":"2023-09-03T09:01:13.000Z","dependencies_parsed_at":"2022-09-05T13:50:43.420Z","dependency_job_id":null,"html_url":"https://github.com/nihilor/trimfandango","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nihilor/trimfandango","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihilor%2Ftrimfandango","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihilor%2Ftrimfandango/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihilor%2Ftrimfandango/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihilor%2Ftrimfandango/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nihilor","download_url":"https://codeload.github.com/nihilor/trimfandango/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nihilor%2Ftrimfandango/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34121021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["adventure","javascript","pure","trim","trimming"],"created_at":"2025-01-10T12:31:28.651Z","updated_at":"2026-06-09T18:31:45.353Z","avatar_url":"https://github.com/nihilor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trimfandango\n\nAdvanced trimming of strings by providing lists of characters or full strings.\n\n## Installation\n\nJust run the following command:\n\n```\nnpm install trimfandango\n```\n\n## Syntax\n\nThe basic syntax:\n\n```js\nFunction trimFandango(String text, (Array|String charlist)): String\n```\n\nThe `trimFandango()` function removes a set of characters from both ends of a string. By default it removes all whitespaces characters: `nul`-bytes, ordinary whitespaces, horizontal and vertical tabs, new lines and carriage returns. It returns the trimmed string.\n\n* `0x00`, ASCII 00, `NUL`-byte\n* `0x09`, ASCII 09, tab\n* `0x0A`, ASCII 10, new line/line feed\n* `0x0B`, ASCII 11, vertical tab\n* `0x0D`, ASCII 13, carriage return\n* `0x20`, ASCII 32, whitespace\n* `0xA0`, ASCII 160, no-break space\n\n## Description\n\nChange the trimming behaviour by optionally providing a `charlist`. The `charlist` can be an `Array` or any other value. Be aware, that any other value than an array will be converted to a string.\n\n### Array of characters\n\nIf you provide an array of single characters, all matched characters in any order will be removed from the beginning and the end of the string. You can either provide normal characters, unicode or specific regular expression tokens. In case of tokens take care that you double-backslash them, i.e. `\\\\s` instead of `\\s`.\n\n```js\nconst trimFandango = require('trimfandango')\n\nconsole.log(\n    trimFandango(\n        '#55  ### #55 55§5   FOOBAR   # 55§\u0026    ',\n        [\"\\\\s\",\"#\",\"\u0026\",\"5\",\"§\"]\n    )\n)\n```\n\nThe output:\n\n```js\nFOOBAR\n```\n\n### String of characters\n\nIf you provide a string of characters - or any other value that converts to a string - the string and its possible subsets will removed from both ends of the `text`.\n\n```js\nconst trimFandango = require('trimfandango')\n\nconsole.log(\n    trimFandango(\n        '12FOOBAR23',\n        123\n    )\n)\n```\nThe output:\n\n```js\nFOOBAR\n```\n\n## Trivia\n\n1. trimfandango is heavily inspired by the `trim()` function of PHP.\n2. The name is a reminiscence to Grim Fandango, authored by the awesome [Tim Schafer](https://twitter.com/TimOfLegend).\n3. This is a pure package without any dependencies, excutable in the frontend and backend.\n\n## LICENSE\n\nMIT License\n\nCopyright (c) 2021 Mark Lubkowitz\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnihilor%2Ftrimfandango","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnihilor%2Ftrimfandango","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnihilor%2Ftrimfandango/lists"}