{"id":21327148,"url":"https://github.com/butonly/string-replacer","last_synced_at":"2025-03-16T00:13:00.497Z","repository":{"id":57372514,"uuid":"53777738","full_name":"butonly/string-replacer","owner":"butonly","description":"asynchronous/synchronous string replace","archived":false,"fork":false,"pushed_at":"2016-04-18T05:09:52.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-11T20:47:08.086Z","etag":null,"topics":["async-replace","regexp","string","string-manipulation","string-replace"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/butonly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-13T09:47:19.000Z","updated_at":"2023-03-04T06:10:54.000Z","dependencies_parsed_at":"2022-09-07T19:12:48.056Z","dependency_job_id":null,"html_url":"https://github.com/butonly/string-replacer","commit_stats":null,"previous_names":["liuyanjie/string-replacer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butonly%2Fstring-replacer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butonly%2Fstring-replacer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butonly%2Fstring-replacer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/butonly%2Fstring-replacer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/butonly","download_url":"https://codeload.github.com/butonly/string-replacer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806072,"owners_count":20350775,"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":["async-replace","regexp","string","string-manipulation","string-replace"],"created_at":"2024-11-21T21:16:13.041Z","updated_at":"2025-03-16T00:13:00.476Z","avatar_url":"https://github.com/butonly.png","language":"JavaScript","readme":"string-replacer\r\n===============\r\n\r\n### strReplacer#replace\r\n    \r\n * `str`         - target string to be replace.\r\n * `regexp`      - A RegExp object.\r\n * `iterator`    - A function to be invoked to create the new substring.\r\n\r\n```js\r\nlet content = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\r\nlet reg = /[A-Y]/g;\r\nlet str = strSplicer.replace(content, new RegExp(reg), (match)=\u003e {\r\n // match is the result of RegExp(reg).exec()\r\n return match[0] + '-';\r\n});\r\n // str: A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z\r\n```\r\n\r\n### strReplacer#replaceAsync\r\n\r\n * `str`               - target string to be replace.\r\n * `regexp`            - A RegExp object.\r\n * `iteratorAsync`     - A function to be invoked with the new substring callback.\r\n * `done`              - invoked until no more substring matches by `regexp` in `str`\r\n\r\n```js\r\nlet content = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\r\nlet reg = /[A-Y]/g;\r\nstrSplicer.replaceAsync(content, new RegExp(reg), iteratorAsync(match, cb)=\u003e {\r\n // match is the result of RegExp(reg).exec()\r\n cb(null, match[0] + '-');\r\n}, (err, str)=\u003e {\r\n // err: null\r\n // str: A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z\r\n});\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbutonly%2Fstring-replacer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbutonly%2Fstring-replacer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbutonly%2Fstring-replacer/lists"}