is-git-ref-name-valid
Check that a git reference name is well formed
Last updated 5 years ago by vweevers .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-git-ref-name-valid 
SYNC missed versions from official npm registry.

is-git-ref-name-valid

Check that a git reference name is well formed, per git-check-ref-format(1).

npm status node JavaScript Style Guide

Usage

const validRef = require('is-git-ref-name-valid')

validRef('refs/heads/foo.bar') // true
validRef('refs/heads/foo^bar') // false

Same as git check-ref-format, the reference name must contain a / by default. This can be disabled:

validRef('ünicöde')       // false
validRef('ünicöde', true) // true

To validate branch names, for which there are additional rules, use is-git-branch-name-valid.

API

validRef(name[, onelevel])

Takes a string name and an optional onelevel boolean. Returns true if name is well formed. Throws if name is not a string. If onelevel is true then name does not have to contain a /.

Install

With npm do:

npm install is-git-ref-name-valid

License

MIT © Vincent Weevers

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |