default-branch
Advanced tools
Comparing version 1.0.7 to 1.0.8
'use strict'; | ||
const https = require('https'); | ||
const regexp = /\?name=(.*)">/g; // The default branch is always the first on the page | ||
const regexp = /class="(.*)branch-name(.*)>(.*)</g; // The default branch is always the first on the page | ||
@@ -32,3 +32,3 @@ module.exports = path => { | ||
// The first item (0) will be at the top and will be the default branch | ||
const regexMatch = data.match(regexp)[0].split('=')[1].split('"')[0]; | ||
const regexMatch = data.match(regexp)[0].split('>')[1].split('<')[0]; | ||
return resolve(regexMatch); | ||
@@ -35,0 +35,0 @@ } catch (err) { |
{ | ||
"name": "default-branch", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Get the default branch of a GitHub repository", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,2 +10,8 @@ import test from 'ava'; | ||
test('long version 2', t => { | ||
return m('https://github.com/Knutakir/has-license').then(branch => { | ||
t.is(branch, 'master'); | ||
}); | ||
}); | ||
test('short version', t => { | ||
@@ -12,0 +18,0 @@ return m('Knutakir/emorjis').then(branch => { |
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
4823
51