assert-valid-github-label-name

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i assert-valid-github-label-name

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn