vweevers / is-git-branch-name-valid

Check that a git branch name is well formed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Check that a git branch name is well formed.

License:MIT License


Languages

Language:JavaScript 100.0%