repository-provider
Advanced tools
Comparing version 2.10.0 to 2.10.1
@@ -449,12 +449,22 @@ 'use strict'; | ||
* @see {@link Repository#defaultBranch} | ||
* @param {string} name | ||
* @param {string} name with optional branch name as '#myBranchName' | ||
* @return {Promise<Branch>} | ||
*/ | ||
async branch(name) { | ||
const repository = await this.repository(name); | ||
const m = name.match(/#(\w+)$/); | ||
if (m) { | ||
return repository.branch(m[1]); | ||
const [repoName, branchName] = name.split(/#/); | ||
let repository; | ||
if (branchName !== undefined) { | ||
repository = await this.repository(repoName); | ||
if (repository !== undefined) { | ||
return repository.branch(branchName); | ||
} | ||
} | ||
repository = await this.repository(repoName); | ||
if (repository === undefined) { | ||
throw new Error(`Unknown repository ${repoName}`); | ||
} | ||
return repository.defaultBranch; | ||
@@ -476,4 +486,3 @@ } | ||
*/ | ||
get type() | ||
{ | ||
get type() { | ||
return 'git'; | ||
@@ -480,0 +489,0 @@ } |
{ | ||
"name": "repository-provider", | ||
"version": "2.10.0", | ||
"version": "2.10.1", | ||
"main": "dist/repository-provider.js", | ||
@@ -5,0 +5,0 @@ "module": "src/repository-provider.js", |
@@ -157,3 +157,3 @@ [![npm](https://img.shields.io/npm/v/repository-provider.svg)](https://www.npmjs.com/package/repository-provider) | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** with optional branch name as '#myBranchName' | ||
@@ -160,0 +160,0 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Branch](#branch)>** |
@@ -95,12 +95,22 @@ import { Branch } from './branch'; | ||
* @see {@link Repository#defaultBranch} | ||
* @param {string} name | ||
* @param {string} name with optional branch name as '#myBranchName' | ||
* @return {Promise<Branch>} | ||
*/ | ||
async branch(name) { | ||
const repository = await this.repository(name); | ||
const m = name.match(/#(\w+)$/); | ||
if (m) { | ||
return repository.branch(m[1]); | ||
const [repoName, branchName] = name.split(/#/); | ||
let repository; | ||
if (branchName !== undefined) { | ||
repository = await this.repository(repoName); | ||
if (repository !== undefined) { | ||
return repository.branch(branchName); | ||
} | ||
} | ||
repository = await this.repository(repoName); | ||
if (repository === undefined) { | ||
throw new Error(`Unknown repository ${repoName}`); | ||
} | ||
return repository.defaultBranch; | ||
@@ -122,6 +132,5 @@ } | ||
*/ | ||
get type() | ||
{ | ||
get type() { | ||
return 'git'; | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41245
871