Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gitdiff-parser

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitdiff-parser - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

53

index.js

@@ -11,3 +11,41 @@ /**

function parsePathFromFirstLine(line) {
var filesStr = line.slice(11);
var oldPath = null;
var newPath = null;
var quoteIndex = filesStr.indexOf('"');
switch (quoteIndex) {
case -1:
var segs = filesStr.split(' ');
oldPath = segs[0].slice(2);
newPath = segs[1].slice(2);
break;
case 0:
var nextQuoteIndex = filesStr.indexOf('"', 2);
oldPath = filesStr.slice(3, nextQuoteIndex);
var newQuoteIndex = filesStr.indexOf('"', nextQuoteIndex + 1);
if (newQuoteIndex < 0) {
newPath = filesStr.slice(nextQuoteIndex + 4);
}
else {
newPath = filesStr.slice(newQuoteIndex + 3, -1);
}
break;
default:
var segs = filesStr.split(' ');
oldPath = segs[0].slice(2);
newPath = segs[1].slice(3, -1);
break;
}
return {
oldPath: oldPath,
newPath: newPath
};
}
var parser = {

@@ -27,2 +65,3 @@ /**

var changeNewLine;
var paths;

@@ -39,6 +78,9 @@

// read file
paths = parsePathFromFirstLine(line);
currentInfo = {
hunks: [],
oldEndingNewLine: true,
newEndingNewLine: true
newEndingNewLine: true,
oldPath: paths.oldPath,
newPath: paths.newPath
};

@@ -90,3 +132,2 @@

break;

@@ -121,4 +162,8 @@ case 'copy':

currentInfo.oldPath = oldPath;
currentInfo.newPath = newPath;
if (oldPath) {
currentInfo.oldPath = oldPath;
}
if (newPath) {
currentInfo.newPath = newPath;
}
stat = STAT_HUNK;

@@ -125,0 +170,0 @@ break simiLoop;

2

package.json
{
"name": "gitdiff-parser",
"version": "0.3.0",
"version": "0.3.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

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