{"id":20884821,"url":"https://github.com/topcli/text-align","last_synced_at":"2025-05-12T18:31:42.303Z","repository":{"id":45917645,"uuid":"248777743","full_name":"TopCli/text-align","owner":"TopCli","description":"A wide-character aware text alignment 🎯 function for use in terminals / on the console 📟.","archived":false,"fork":false,"pushed_at":"2025-05-01T14:20:22.000Z","size":164,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T15:29:42.764Z","etag":null,"topics":["align","alignment","cli","text","widealign"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/TopCli.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-20T14:38:03.000Z","updated_at":"2025-05-01T14:20:26.000Z","dependencies_parsed_at":"2024-11-18T08:11:45.841Z","dependency_job_id":"ef5122f0-ec2c-4b89-b35b-14066b708dab","html_url":"https://github.com/TopCli/text-align","commit_stats":null,"previous_names":["slimio/align-center"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Ftext-align","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Ftext-align/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Ftext-align/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Ftext-align/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TopCli","download_url":"https://codeload.github.com/TopCli/text-align/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253798160,"owners_count":21966017,"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":["align","alignment","cli","text","widealign"],"created_at":"2024-11-18T08:11:42.192Z","updated_at":"2025-05-12T18:31:42.286Z","avatar_url":"https://github.com/TopCli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# text-align\n![version](https://img.shields.io/badge/dynamic/json.svg?style=for-the-badge\u0026url=https://raw.githubusercontent.com/TopCli/text-align/master/package.json\u0026query=$.version\u0026label=Version)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://github.com/TopCli/text-align/commit-activity)\n[![mit](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://github.com/TopCli/text-align/blob/master/LICENSE)\n[![OpenSSF\nScorecard](https://api.securityscorecards.dev/projects/github.com/TopCli/text-align/badge?style=for-the-badge)](https://api.securityscorecards.dev/projects/github.com/TopCli/text-align)\n![build](https://img.shields.io/github/actions/workflow/status/TopCli/text-align/node.js.yml?style=for-the-badge)\n\nA wide-character aware text alignment function for use in terminals / on the console. This package is a modern implementation of [wide-align](https://github.com/iarna/wide-align) with String.prototype.padLeft and String.prototype.padRight.\n\n## Requirements\n- [Node.js](https://nodejs.org/en/) v22 or higher\n\n## Getting Started\n\nThis package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).\n\n```bash\n$ npm i @topcli/text-align\n# or\n$ yarn add @topcli/text-align\n```\n\n### Usage example\n\n```js\nimport * as align from \"@topcli/text-align\";\n\nconsole.log(align.center('abc', 10));     // '   abc    '\nconsole.log(align.center('古古古', 10));   // '  古古古  '\nconsole.log(align.left('abc', 10));       // 'abc       '\nconsole.log(align.left('古古古', 10));     // '古古古    '\nconsole.log(align.right('abc', 10));      // '       abc'\nconsole.log(align.right('古古古', 10));    // '    古古古'\n```\n\n## API\n\n### `align.center(str: string, length: number)` → string\nReturns *str* with spaces added to both sides such that that it is *length*\nchars long and centered in the spaces.\n\n### `align.left(str: string, length: number)` → string\nReturns *str* with spaces to the right such that it is *length* chars long.\n\n### `align.right(str: string, length: number)` → string\nReturns *str* with spaces to the left such that it is *length* chars long.\n\n## Contributors ✨\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/thomas-gentilhomme/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4438263?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eGentilhomme\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/text-align/commits?author=fraxken\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/text-align/commits?author=fraxken\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/text-align/pulls?q=is%3Apr+reviewed-by%3Afraxken\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"#security-fraxken\" title=\"Security\"\u003e🛡️\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/text-align/issues?q=author%3Afraxken\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/Max2810\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/53535185?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMax\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/text-align/commits?author=Max2810\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopcli%2Ftext-align","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftopcli%2Ftext-align","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopcli%2Ftext-align/lists"}