{"id":22202140,"url":"https://github.com/rumkin/to-format","last_synced_at":"2025-08-10T11:04:57.212Z","repository":{"id":57159095,"uuid":"130407226","full_name":"rumkin/to-format","owner":"rumkin","description":"Convert string literal to formatter function","archived":false,"fork":false,"pushed_at":"2018-04-26T18:05:41.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-26T00:29:35.991Z","etag":null,"topics":["javascript","strings","templates","utils"],"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/rumkin.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":"2018-04-20T19:47:07.000Z","updated_at":"2018-04-26T18:05:42.000Z","dependencies_parsed_at":"2022-09-08T10:40:07.109Z","dependency_job_id":null,"html_url":"https://github.com/rumkin/to-format","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rumkin/to-format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fto-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fto-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fto-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fto-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumkin","download_url":"https://codeload.github.com/rumkin/to-format/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fto-format/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269713883,"owners_count":24463244,"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-08-10T02:00:08.965Z","response_time":71,"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":["javascript","strings","templates","utils"],"created_at":"2024-12-02T16:12:31.964Z","updated_at":"2025-08-10T11:04:57.033Z","avatar_url":"https://github.com/rumkin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Convert template literal to formatter function.\n\n[![npm](https://img.shields.io/npm/v/to-fmt.svg?style=flat-square)](https://npmjs.com/package/to-fmt)\n[![Travis](https://img.shields.io/travis/rumkin/to-format.svg?style=flat-square)](https://travis-ci.org/rumkin/to-format)\n![](https://img.shields.io/badge/coverage-100%25-green.svg?style=flat-square)\n![](https://img.shields.io/badge/size-0.7%20KiB-blue.svg?style=flat-square)\n![](https://img.shields.io/badge/deps-0-blue.svg?style=flat-square)\n[![npm](https://img.shields.io/npm/dm/to-fmt.svg?style=flat-square)](https://npmjs.com/packages/to-fmt)\n\n## Install\n\nWith npm:\n\n```bash\nnpm i to-fmt\n```\n\n## Usage\n\nHello world example:\n\n```javascript\nimport f from 'to-fmt';\n\nconst format = f`Hello, ${String}!`;\n\nformat('World'); // -\u003e 'Hello, World!'\n```\n\nNumber formatter:\n\n```javascript\nimport f from 'to-fmt';\n\nconst toFixed = n =\u003e number =\u003e number.toFixed(n);\n\nconst format = f`Value is ${toFixed(2)}!`;\n\nformat(1); // -\u003e 'Value is 1.00!'\nformat(3.14159); // -\u003e 'Value is 3.14!'\n```\n\nMultiple values example:\n```javascript\nimport f from 'to-fmt';\nimport bytes from 'pretty-bytes';\n\nconst format = f`\"${String}\" size is ${bytes}!`;\n\nformat('index.js', 1024); // -\u003e '\"index.js\" size is 1 KiB'\n```\n\n## License\n\nMIT.\n\n## Copyright\n\n\u0026copy; 2018, Rumkin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fto-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumkin%2Fto-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fto-format/lists"}