{"id":21913230,"url":"https://github.com/kevinhermawan/strpolate","last_synced_at":"2026-04-18T02:03:11.284Z","repository":{"id":65174963,"uuid":"585548061","full_name":"kevinhermawan/strpolate","owner":"kevinhermawan","description":"Fast string interpolation with built-in type validation","archived":false,"fork":false,"pushed_at":"2023-09-13T13:36:48.000Z","size":403,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-29T10:03:17.353Z","etag":null,"topics":["dynamic-strings","javascript","string","string-formatting","string-interpolation","string-template","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/strpolate","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/kevinhermawan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2023-01-05T13:02:10.000Z","updated_at":"2023-03-09T18:29:40.000Z","dependencies_parsed_at":"2024-10-13T09:01:09.081Z","dependency_job_id":"dd34c407-9dd2-422a-a135-36bd3af0ff32","html_url":"https://github.com/kevinhermawan/strpolate","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"676162abec6574cf93bdb26fa1635cecfb72b7ae"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/kevinhermawan/strpolate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinhermawan%2Fstrpolate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinhermawan%2Fstrpolate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinhermawan%2Fstrpolate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinhermawan%2Fstrpolate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinhermawan","download_url":"https://codeload.github.com/kevinhermawan/strpolate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinhermawan%2Fstrpolate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31953515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["dynamic-strings","javascript","string","string-formatting","string-interpolation","string-template","typescript"],"created_at":"2024-11-28T18:15:19.800Z","updated_at":"2026-04-18T02:03:11.247Z","avatar_url":"https://github.com/kevinhermawan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Strpolate\n\n![Minified size](https://img.shields.io/bundlephobia/min/strpolate) ![Test coverage](https://img.shields.io/codecov/c/github/kevinhermawan/strpolate) ![Monthly download](https://img.shields.io/npm/dm/strpolate)\n\nStrpolate is a JavaScript library that offers fast string interpolation by replacing placeholders in the string with corresponding values from an object. It also includes type validation to ensure that the values being inserted match the expected data type of the placeholder.\n\n## Features\n\n- Fast string interpolation\n- Built-in type validation\n- Supports Deno via NPM\n- Zero dependencies\n\n## Installation\n\nTo install `strpolate`, run the following command:\n\n**NPM**\n\n```\nnpm install strpolate\n```\n\n**Yarn**\n\n```\nyarn add strpolate\n```\n\n**pnpm**\n\n```\npnpm add strpolate\n```\n\n## Usage\n\nYou can use the following type specifiers in the placeholders: `%s` or `%string` for string values, `%n` or `%number` for number values, and `%b` or `%boolean` for boolean values. If no type specifier is provided, the default type is assumed to be `string`.\n\n```ts\nimport strpolate from \"strpolate\";\n// import strpolate from \"npm:strpolate\"; // (for Deno)\n\nconst result = strpolate(\n  \"The value of message is %{message}, the value of count is %number{count}, and the value of enabled is %boolean{enabled}\",\n  { message: \"Hello, world!\", count: 5, enabled: true }\n);\n\n// result is \"The value of message is Hello, world!, the value of count is 5, and the value of enabled is true\"\n```\n\nIf a placeholder is missing a corresponding value in the `values` object, or if the value has the wrong type, `strpolate` will throw an error.\n\n```ts\nimport strpolate from \"strpolate\";\n// import strpolate from \"npm:strpolate\"; // (for Deno)\n\n// Throws an error because the 'count' placeholder is missing a corresponding value in the 'values' object\nstrpolate(\n  \"The value of message is %{message}, and the value of count is %number{count}\",\n  { message: \"Hello, world!\" }\n);\n\n// Throws an error because the value for the 'count' placeholder is a string, but the placeholder expects a number\nstrpolate(\n  \"The value of message is %{message}, and the value of count is %number{count}\",\n  { message: \"Hello, world!\", count: \"5\" }\n);\n```\n\n## Syntax\n\n```ts\nstrpolate(string: string, values: Record\u003cstring, string | number | boolean | undefined\u003e): string\n```\n\n## License\n\n[MIT License](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinhermawan%2Fstrpolate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinhermawan%2Fstrpolate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinhermawan%2Fstrpolate/lists"}