{"id":22840887,"url":"https://github.com/mkloubert/js-strings","last_synced_at":"2026-04-17T00:33:16.246Z","repository":{"id":57682954,"uuid":"486123244","full_name":"mkloubert/js-strings","owner":"mkloubert","description":"String helpers.","archived":false,"fork":false,"pushed_at":"2022-04-28T00:54:30.000Z","size":92,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-04T09:13:56.687Z","etag":null,"topics":["browser","format","function","helper","javascript","js","nodejs","string","stringbuilder","ts","typescript"],"latest_commit_sha":null,"homepage":"https://mkloubert.github.io/js-strings/","language":"TypeScript","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/mkloubert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"mkloubert","custom":["https://marcel.coffee/"]}},"created_at":"2022-04-27T09:13:19.000Z","updated_at":"2022-04-27T22:29:30.000Z","dependencies_parsed_at":"2022-09-15T18:00:31.886Z","dependency_job_id":null,"html_url":"https://github.com/mkloubert/js-strings","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mkloubert/js-strings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fjs-strings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fjs-strings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fjs-strings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fjs-strings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkloubert","download_url":"https://codeload.github.com/mkloubert/js-strings/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fjs-strings/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31910086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["browser","format","function","helper","javascript","js","nodejs","string","stringbuilder","ts","typescript"],"created_at":"2024-12-13T01:13:55.920Z","updated_at":"2026-04-17T00:33:16.227Z","avatar_url":"https://github.com/mkloubert.png","language":"TypeScript","readme":"[![npm](https://img.shields.io/npm/v/@marcelkloubert/strings.svg)](https://www.npmjs.com/package/@marcelkloubert/strings)\n[![last build](https://img.shields.io/github/workflow/status/mkloubert/js-strings/Publish)](https://github.com/mkloubert/js-strings/actions?query=workflow%3APublish)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/mkloubert/js-strings/pulls)\n\n# @marcelkloubert/strings\n\n\u003e String helpers, for [Node.js 14+](https://nodejs.org/en/blog/release/v14.0.0/) and the browser.\n\n## Install\n\nExecute the following command from your project folder, where your `package.json` file is stored:\n\n```bash\nnpm i @marcelkloubert/strings\n```\n\n## Usage\n\n### asString(value: any): string\n\n```typescript\nimport { asString } from \"@marcelkloubert/strings\"\n\nconst myObject = {\n  toString: () =\u003e \"!!!myObject!!!\",\n}\n\nasString(12)  // \"12\"\nasString(\"\")  // \"\"\nasString(null)  // \"\"\nasString(undefined)  // \"\"\nasString(myObject)  // \"!!!myObject!!!\"\n```\n\n### format(formatStr: string. ...args: any[]): string\n\n```typescript\nimport { format } from \"@marcelkloubert/strings\"\n\nformat(\"{1}, {0}\", \"Marcel\", \"Kloubert\")  // \"Kloubert, Marcel\"\nformat(\"{1:lower,trim}, {0:upper}\", \"Marcel\", \"  kloubert  \")  // \"kloubert, MARCEL\"\nformat(\"{1}, {0} Joachim\", null, undefined)  // \"{1},  Joachim\"\n```\n\n### formatArray(formatStr: string, args: List): string\n\n```typescript\nimport { formatArray } from \"@marcelkloubert/strings\"\n\nfunction* asGenerator(...args: any[]) {\n  for (const a of args) {\n    yield a\n  }\n}\n\nformatArray(\"{1}, {0}\", [\"Marcel\", \"Kloubert\"])  // \"Kloubert, Marcel\"\nformatArray(\"{1:lower,trim}, {0:upper}\", asGenerator(\"Marcel\", \"  kloubert  \"))  // \"kloubert, MARCEL\"\nformatArray(\"{1}, {0} Joachim\", [null, undefined])  // \"{1},  Joachim\"\n```\n\n### StringBuilder\n\n```typescript\nimport { StringBuilder } from \"@marcelkloubert/strings\"\n\nconst str = new StringBuilder(\"Bar\") // \"Bar\"\n  .append(\"Foo\") // \"FooBar\"\n  .prependFormat(\"{1}, {0:upper,trim} \", \"  Marcel  \", \"Klbert\") // \"Klbert, MARCEL FooBar\"\n  .replace(\"MARCEL\", \"Tanja\") // \"Klbert, Tanja FooBar\"\n  .insert(2, \"ou\") // \"Kloubert, Tanja FooBar\"\n  .clear() // \"\"\n\nstr.isEmpty // (true)\nstr.equals(\"\") // (true)\nstr.equals(null) // (true)\nstr.equals(undefined) // (true)\n```\n\n## Documentation\n\nThe API documentation can be found [here](https://mkloubert.github.io/js-strings/).\n\n\n## License\n\nMIT © [Marcel Joachim Kloubert](https://github.com/mkloubert)\n\n## Support and contribute\n\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://paypal.me/MarcelKloubert\" title=\"Donate to this project using PayPal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/mkloubert\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/mkloubert\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n[Contribution guidelines](./CONTRIBUTE.md)\n","funding_links":["https://patreon.com/mkloubert","https://marcel.coffee/","https://paypal.me/MarcelKloubert","https://buymeacoffee.com/mkloubert"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkloubert%2Fjs-strings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkloubert%2Fjs-strings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkloubert%2Fjs-strings/lists"}