{"id":22680423,"url":"https://github.com/aligay/safe-trim","last_synced_at":"2025-09-21T12:10:09.831Z","repository":{"id":10349455,"uuid":"65449527","full_name":"aligay/safe-trim","owner":"aligay","description":"🈳 trim all unsafe space ","archived":false,"fork":false,"pushed_at":"2024-09-26T03:53:00.000Z","size":2637,"stargazers_count":68,"open_issues_count":23,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-31T19:52:44.565Z","etag":null,"topics":["trim","trimming","zero-width-space"],"latest_commit_sha":null,"homepage":"https://npmjs.org/safe-trim","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/aligay.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-11T07:46:52.000Z","updated_at":"2025-06-05T03:00:14.000Z","dependencies_parsed_at":"2024-06-19T01:46:14.848Z","dependency_job_id":"cafe09b7-ae26-49d1-aa10-808b17355b36","html_url":"https://github.com/aligay/safe-trim","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.4,"last_synced_commit":"938178a327d31617b501d195368842f958bd9ce6"},"previous_names":["haozi/safe-trim"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/aligay/safe-trim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligay%2Fsafe-trim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligay%2Fsafe-trim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligay%2Fsafe-trim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligay%2Fsafe-trim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aligay","download_url":"https://codeload.github.com/aligay/safe-trim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligay%2Fsafe-trim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276237661,"owners_count":25608288,"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","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"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":["trim","trimming","zero-width-space"],"created_at":"2024-12-09T19:13:36.814Z","updated_at":"2025-09-21T12:10:09.800Z","avatar_url":"https://github.com/aligay.png","language":"JavaScript","readme":"# safe-trim\n---\n\n[![Build Status](https://travis-ci.org/aligay/safe-trim.svg?branch=master)](https://travis-ci.org/aligay/safe-trim/branches)\n[![codecov](https://codecov.io/gh/aligay/safe-trim/branch/master/graph/badge.svg)](https://codecov.io/gh/aligay/safe-trim)\n[![dependencies Status](https://david-dm.org/aligay/safe-trim/status.svg)](https://david-dm.org/aligay/safe-trim)\n[![devDependencies Status](https://david-dm.org/aligay/safe-trim/dev-status.svg)](https://david-dm.org/aligay/safe-trim?type=dev)\n\n## install\n```\nnpm install safe-trim\n```\n## use\n```\nimport safeTrim from 'safe-trim'\nsafeTrim('    a      b  ')\n```\n\n## remove Invisible spaces\n\n```\nlet str = '  \"a\":1    a \\r\\n\\r\\t  ᠎             　b       '\nlet ret = safeTrim(str)\nexpect(ret).toEqual('\"a\":1    a\\n\\nb')\n```\n\n## convert CR CR-LR into LR\n```\na\\r\\n\\r\\nb  =\u003e 'a\\n\\nb'\na\\r\\rb =\u003e 'a\\n\\nb'\na\\r\\r\\nb =\u003e 'a\\n\\nb'\n```\n\n## remove BOM\n```\nJSON.parse('﻿{\"a\":1}') // ❗️Error because BOM\n\nJSON.parse(safeTrim('﻿{\"a\":1}')) // ✅\n```\n\n\n## more feature\n[more feature](spec/test_spec.js)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligay%2Fsafe-trim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faligay%2Fsafe-trim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligay%2Fsafe-trim/lists"}