Socket
Socket
Sign inDemoInstall

default-branch

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

default-branch - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

4

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc