1.0.1 • Published 3 years ago

is-git-branch-name-valid v1.0.1

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

is-git-branch-name-valid

Check that a git branch name is well formed.

npm status node Test JavaScript Style Guide

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:

  1. Is a valid reference name
  2. Does not equal HEAD or start with -.

Install

With npm do:

npm install is-git-branch-name-valid

License

MIT © Vincent Weevers