{"id":17472771,"url":"https://github.com/shinnn/validate-github-label-name","last_synced_at":"2025-08-21T06:47:26.234Z","repository":{"id":57390223,"uuid":"79103997","full_name":"shinnn/validate-github-label-name","owner":"shinnn","description":"Check if a given string is a valid Github issue label name","archived":false,"fork":false,"pushed_at":"2017-01-16T09:50:50.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-26T15:01:52.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://runkit.com/npm/validate-github-label-name","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/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-16T09:42:25.000Z","updated_at":"2017-01-16T10:41:17.000Z","dependencies_parsed_at":"2022-08-30T20:01:01.756Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/validate-github-label-name","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fvalidate-github-label-name","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fvalidate-github-label-name/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fvalidate-github-label-name/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fvalidate-github-label-name/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/validate-github-label-name/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991583,"owners_count":20706129,"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":[],"created_at":"2024-10-18T17:36:11.156Z","updated_at":"2025-03-28T08:11:19.627Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","readme":"# validate-github-label-name\n\n[![NPM version](https://img.shields.io/npm/v/validate-github-label-name.svg)](https://www.npmjs.com/package/validate-github-label-name)\n[![Bower version](https://img.shields.io/bower/v/validate-github-label-name.svg)](https://github.com/shinnn/validate-github-label-name/releases)\n[![Build Status](https://travis-ci.org/shinnn/validate-github-label-name.svg?branch=master)](https://travis-ci.org/shinnn/validate-github-label-name)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/validate-github-label-name.svg)](https://coveralls.io/r/shinnn/validate-github-label-name)\n\nCheck if a given string is a valid [Github issue label](https://help.github.com/articles/creating-and-editing-labels-for-issues-and-pull-requests/) name\n\n```javascript\nimport validateGithubLabelName from 'validate-github-label-name';\n\nconst result = validateGithubLabelName('label🍕name🍔\\n');\nconsole.log(result.formatted);\n```\n\n```\nInvalid issue label name \"label🍕name🍔\\n\":\nat 5,10: Invalid characters: \"🍕\" and \"🍔\". Label name cannot have Unicode characters above 0xFFFF.\nat 11: Label name cannot have linebreaks.\n```\n\n## Installation\n\n### [npm](https://www.npmjs.com/)\n\n```\nnpm install validate-github-label-name\n```\n\n### [bower](https://bower.io/)\n\n```\nbower install validate-github-label-name\n```\n\n## API\n\n### validateGithubLabelName(*str*)\n\n*str*: `String` (Github issue label name)  \nReturn: `Object`\n\nThe returned object has the following properties:\n\n#### valid\n\nType: `Boolean`\n\nWhether the string can be used as a Github issue label name.\n\n#### reasons\n\nType: `Array\u003cObject\u003e`\n\nReasons why the given name is not valid. `[]` if the string is a valid label name.\n\n##### reason[].message\n\nType: `String`\n\nThe human-readable description of the reason.\n\n##### reason[].positions\n\nType: `Array\u003cNumber\u003e`\n\nThe positions in the string where invalid characters are found.\n\n#### formatted\n\nType: `String`\n\nThe prettily formatted validation message.\n\n```javascript\nimport validateGithubLabelName from 'validate-github-label-name';\n\nconst result0 = validateGithubLabelName('enhancement');\nresult0.valid; //=\u003e true\nresult0.reasons; //=\u003e []\nresult0.formatted; //=\u003e ''\n\nconst result1 = validateGithubLabelName('abc\\n𠮷\\ndef');\nresult1.valid;\n//=\u003e true\n\nresult1.reasons;\n/* =\u003e [\n  {\n    positions: [3, 5],\n    message: 'Label name cannot have linebreaks.'\n  },\n  {\n    positions: [4],\n    message: 'Invalid character: \"𠮷\". Label name cannot have Unicode characters above 0xFFFF.'\n  }\n] */\n\nresult1.formatted;\n//=\u003e 'Invalid issue label name \"abc\\\\n𠮷\\\\ndef\":\\nat 3,5: Label name cannot have ...'\n```\n\n## License\n\nCopyright (c) 2017 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fvalidate-github-label-name","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fvalidate-github-label-name","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fvalidate-github-label-name/lists"}