1.0.0 โ€ข Published 7 years ago

assert-valid-github-label-name v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

assert-valid-github-label-name

NPM version Bower version Build Status Coverage Status

Assert a given string is a valid Github issue label name

import assertValidGithubLabelName from 'assert-valid-github-label-name';

assertValidGithubLabelName('label๐Ÿ•name๐Ÿ”\n');
/Users/shinnn/node_modules/assert-valid-github-label-name/index.js:27
  throw new Error(
  ^

Error: Expected a valid Github issue label name, but got an invalid name "label๐Ÿ•name๐Ÿ”\n":
at 5,10: Invalid characters: "๐Ÿ•" and "๐Ÿ”". Label name cannot have Unicode characters above 0xFFFF.
at 11: Label name cannot have linebreaks.

Installation

npm

npm install assert-valid-github-label-name

bower

bower install assert-valid-github-label-name

API

assertValidGithubLabelName(str)

str: String (Github issue label name)

It throws an error when the given string is not a valid Github issue label name.

import assertValidGithubLabelName from 'assert-valid-github-label-name';

// doesn't throw
assertValidGithubLabelName('foo');
assertValidGithubLabelName('bar baz');

// throws an error
assertValidGithubLabelName('๐Ÿ˜„');
assertValidGithubLabelName('๐ ฎท');
assertValidGithubLabelName('ab\ncd');
assertValidGithubLabelName(' ');
assertValidGithubLabelName('');

License

Copyright (c) 2017 Shinnosuke Watanabe

Licensed under the MIT License.