{"id":16037958,"url":"https://github.com/joseluisq/sprintfit","last_synced_at":"2025-07-01T04:36:10.373Z","repository":{"id":57368004,"uuid":"142356953","full_name":"joseluisq/sprintfit","owner":"joseluisq","description":"A fast 450b sprintf \u0026 vsprintf format specifier focused on strings with no dependencies. ⚡️","archived":false,"fork":false,"pushed_at":"2020-05-09T11:32:22.000Z","size":110,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-22T14:23:17.588Z","etag":null,"topics":["sprintf","string-formatter","typescript","vsprintf"],"latest_commit_sha":null,"homepage":"","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/joseluisq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-25T21:42:57.000Z","updated_at":"2021-01-28T16:36:39.000Z","dependencies_parsed_at":"2022-08-23T19:40:49.523Z","dependency_job_id":null,"html_url":"https://github.com/joseluisq/sprintfit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsprintfit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsprintfit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsprintfit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsprintfit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joseluisq","download_url":"https://codeload.github.com/joseluisq/sprintfit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243004645,"owners_count":20220343,"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":["sprintf","string-formatter","typescript","vsprintf"],"created_at":"2024-10-08T22:22:37.039Z","updated_at":"2025-03-17T21:30:36.329Z","avatar_url":"https://github.com/joseluisq.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sprintfit [![Build Status](https://travis-ci.com/joseluisq/sprintfit.svg?branch=master)](https://travis-ci.com/joseluisq/sprintfit) [![npm](https://img.shields.io/npm/v/sprintfit.svg)](https://www.npmjs.com/package/sprintfit) [![npm](https://img.shields.io/npm/dt/sprintfit.svg)](https://www.npmjs.com/package/sprintfit) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n\u003e A [fast](https://jsbench.me/wgjkuw5xly/1) 450b sprintf \u0026 vsprintf format specifier focused on strings with no dependencies. :zap:\n\n*__Note:__ `sprintf` and `vsprintf` will treat their arguments as strings only. If you are looking for the full specification you could try [sprintf.js](https://github.com/alexei/sprintf.js) or [printj](https://github.com/SheetJS/printj).*\n\n## Install\n\n[Yarn](https://github.com/yarnpkg/)\n\n```sh\nyarn add sprintfit\n```\n\n[NPM](https://www.npmjs.com/)\n\n```sh\nnpm install sprintfit\n```\n\n[UMD](https://github.com/umdjs/umd/) file is also available on [unpkg](https://unpkg.com):\n\n```html\n\u003cscript src=\"https://unpkg.com/sprintfit/sprintfit.umd.min.js\"\u003e\u003c/script\u003e\n```\n\nYou can use the library via `window.sprintfit`.\n\n## Usage\n\n### sprintf\n\nReturn a formatted string and accepts a variable number of arguments.\n\n```js\nimport { sprintf } from 'sprintfit'\n\nsprintf('date: %s-%s-%s', 2018, 07, 25)\n// date: 2018-07-25\n```\n\n### vsprintf\n\nOperates as `sprintf()` but accepts an array of arguments.\n\n```js\nimport { vsprintf } from 'sprintfit'\n\nvsprintf('date: %s-%s-%s', [ 2018, 07, 28 ])\n// date: 2018-07-28\n```\n\n## Benchmarks\n\n- Node: `v8.11.3`\n- [BenchmarkJS](https://benchmarkjs.com): `^2.1.4`\n- [Sprintf-js][2]: `^1.1.1`\n- [Printj][3]: `^1.1.2`\n\n```sh\nyarn build\nyarn benchmark\n```\n\n:rocket: Try [beanchmark online](https://jsbench.me/wgjkuw5xly/1)\n\n#### sprintf\n\n| package | ops/sec | rme\n--- | --- | ---\n[Sprintfit][1] | __2,601,688__ | ±5.19% (77 runs sampled)\n[SprintfJS][2] | 1,117,038 | ±1.66% (60 runs sampled)\n[PrintJ][3] | 1,046,954 | ±2.78% (91 runs sampled)\n\n_Done in 18.00s._\n\n#### vsprintf\n\n| package | ops/sec | rme\n--- | --- | ---\n[Sprintfit][1] | __2,774,358__ | ±4.03%  (79 runs sampled)\n[PrintJ][3] | 905,327 | ±3.64% (79 runs sampled)\n[SprintfJS][2] | 675,621 | ±7.06% (63 runs sampled)\n\n_Done in 18.34s._\n\n[1]: https://github.com/joseluisq/sprintfit\n[2]: https://github.com/alexei/sprintf.js\n[3]: https://github.com/SheetJS/printj\n\n#### Node v12\n\nNode: `v12.16.1`\n\n```sh\n# sprintf\n1) Sprintfit: sprintf() x 2,041,472 ops/sec ±3.13% (83 runs sampled)\n2) SprintfJS: sprintf() x 915,427 ops/sec ±2.79% (84 runs sampled)\n3) PrintJ: sprintf() x 1,114,252 ops/sec ±3.55% (79 runs sampled)\n\nFastest is 1) Sprintfit: sprintf()\n\n# vsprintf\n1) Sprintfit: vsprintf() x 2,281,271 ops/sec ±0.52% (91 runs sampled)\n2) SprintfJS: vsprintf() x 704,705 ops/sec ±2.24% (84 runs sampled)\n3) PrintJ: vsprintf() x 1,193,415 ops/sec ±2.13% (83 runs sampled)\n\nFastest is 1) Sprintfit: vsprintf()\n\nDone in 36.05s.\n```\n\n## Contributions\n\nFeel free to send some [Pull request](https://github.com/joseluisq/sprintfit/pulls) or [issue](https://github.com/joseluisq/sprintfit/issues).\n\n## License\nMIT license\n\n© 2018-present [Jose Quintana](http://git.io/joseluisq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Fsprintfit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoseluisq%2Fsprintfit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Fsprintfit/lists"}