Socket
Socket
Sign inDemoInstall

default-branch

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

.travis.yml

6

index.js
'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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc