what-the-diff
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -5,9 +5,4 @@ var parser = require('./lib/parser') | ||
parse: function(input) { | ||
try { | ||
return parser.parse(input.toString()) | ||
} catch (e) { | ||
console.log(e.location) | ||
throw e | ||
} | ||
return parser.parse(input.toString()) | ||
} | ||
} |
@@ -1906,14 +1906,10 @@ /* | ||
} else if (file_modes.old_mode && file_modes.new_mode) { | ||
if (patch || binary) { | ||
return { | ||
newPath: header.file_name, | ||
oldPath: header.file_name, | ||
oldMode: file_modes.old_mode, | ||
newMode: file_modes.new_mode, | ||
hunks: patch ? patch.hunks : [], | ||
status: 'modified', | ||
binary: !!binary | ||
} | ||
} else { | ||
throw new Error('patch or binary expected') | ||
return { | ||
newPath: header.file_name, | ||
oldPath: header.file_name, | ||
oldMode: file_modes.old_mode, | ||
newMode: file_modes.new_mode, | ||
hunks: patch ? patch.hunks : [], | ||
status: 'modified', | ||
binary: !!binary | ||
} | ||
@@ -1920,0 +1916,0 @@ } else { |
{ | ||
"name": "what-the-diff", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "diff parsing library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -523,1 +523,23 @@ var diff = require('../') | ||
} | ||
exports.testNoPatch = function(test) { | ||
var str = dedent` | ||
diff --git file.txt file.txt | ||
old mode 100644 | ||
new mode 100755 | ||
` | ||
const output = diff.parse(str) | ||
assert.deepEqual(output, [ | ||
{ | ||
oldPath: 'file.txt', | ||
newPath: 'file.txt', | ||
oldMode: '100644', | ||
newMode: '100755', | ||
status: 'modified', | ||
hunks: [], | ||
binary: false | ||
}, | ||
]) | ||
test.done() | ||
} |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
13979230
10
2198
0