is-git-branch-name-valid
v1.0.1
Published
Check that a git branch name is well formed
Downloads
1,826
Readme
is-git-branch-name-valid
Check that a git branch name is well formed.
Usage
const validBranch = require('is-git-branch-name-valid')
validBranch('foo.bar') // true
validBranch('foo-bar/baz') // true
validBranch('foo^bar') // false
validBranch('HEAD') // false
validBranch('-foo') // false
API
validBranch(name)
Takes a string name
. Returns true if name
:
- Is a valid reference name
- Does not equal
HEAD
or start with-
.
Install
With npm do:
npm install is-git-branch-name-valid
License
MIT © Vincent Weevers