Socket
Socket
Sign inDemoInstall

git-branch-away

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

git-branch-away - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

19

index.js
var shell = require('shelljs');
let allLocalBranches;
let allBranches;
let remoteBranches;
let rootDir;
exports.init = (cwd = process.cwd()) => {
allLocalBranches = (shell.exec(`git branch`, {silent: true, cwd}) || '').toString().split('\n').filter(f=>f!='');
allBranches = (shell.exec(`git branch`, {silent: true, cwd}) || '').toString().split('\n').filter(f=>f!='');
remoteBranches = (shell.exec(`git branch -r`, {silent: true, cwd}) || '').toString().split('\n').filter(f=>f!='').map(f=>f.trim().split(' ')[0]);
allBranches = allBranches.concat(remoteBranches.map(b=>b.split('/').slice(1).join('/'))); // remove 'origin/' prefix
rootDir = shell.exec(`git rev-parse --show-toplevel`, {silent: true, cwd}).toString();

@@ -30,8 +33,13 @@ }

exports.current = () => {
return allLocalBranches.find(b => b[0] === '*').split('*')[1].trim();
return allBranches.find(b => b[0] === '*').split('*')[1].trim();
}
exports.other = () => allLocalBranches.filter(l => l[0] !== '*').map((n) => n.trim());
// split to different function because might be
exports.remote = () => {
return remoteBranches;
}
exports.all = (branches=allLocalBranches) => branches.map(b => {
exports.other = () => allBranches.filter(l => l[0] !== '*').map((n) => n.trim());
exports.all = (branches=allBranches) => branches.map(b => {
if (b[0] === '*') {

@@ -50,4 +58,5 @@ return b.slice(1).trim();

all: exports.all(),
remotes: remoteBranches,
root: rootDir
}
}
{
"name": "git-branch-away",
"description": "gets branches for repo in git",
"version": "0.0.11",
"version": "0.0.12",
"dependencies": {

@@ -6,0 +6,0 @@ "semistandard": "^12.0.1",

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