default-branch
Advanced tools
Comparing version 1.0.4 to 1.0.5
'use strict'; | ||
const https = require('https'); | ||
const regexp = /class="branch-name css-truncate-target">(.*?)</g; | ||
const regexp = /\?name=(.*)">/g; // The default branch is always the first on the page | ||
@@ -31,5 +31,5 @@ module.exports = path => { | ||
try { | ||
const regexMatch = data.match(regexp); | ||
const regexMatch = regexp.exec(data)[1]; | ||
// The first item (0) will be at the top and will be the default branch | ||
resolve(regexMatch[0].split('>')[1].split('<')[0]); | ||
return resolve(regexMatch); | ||
} catch (err) { | ||
@@ -36,0 +36,0 @@ reject(new Error('Failed to get default branch: ' + err)); |
{ | ||
"name": "default-branch", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Get the default branch of a GitHub repository", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "ava" | ||
}, | ||
@@ -24,3 +24,6 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/Knutakir/default-branch#readme" | ||
"homepage": "https://github.com/Knutakir/default-branch#readme", | ||
"devDependencies": { | ||
"ava": "^0.24.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# default-branch | ||
# default-branch [![Build Status](https://travis-ci.org/Knutakir/default-branch.svg?branch=master)](https://travis-ci.org/Knutakir/default-branch) | ||
> Get the default branch of a GitHub repository | ||
@@ -3,0 +3,0 @@ |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
6
47
0
4617
1