what-the-diff
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -471,3 +471,3 @@ /* | ||
function peg$parsebinary_diff() { | ||
var s0, s1, s2, s3; | ||
var s0, s1, s2, s3, s4; | ||
@@ -491,7 +491,16 @@ var key = peg$currPos * 35 + 2, | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parsebinary_declaration(); | ||
s3 = peg$parsepatch_header(); | ||
if (s3 === peg$FAILED) { | ||
s3 = null; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c1(s1, s2); | ||
s0 = s1; | ||
s4 = peg$parsebinary_declaration(); | ||
if (s4 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c1(s1, s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
@@ -677,4 +686,7 @@ peg$currPos = s0; | ||
if (s6 !== peg$FAILED) { | ||
s7 = peg$parsepatch(); | ||
s7 = peg$parsebinary_declaration(); | ||
if (s7 === peg$FAILED) { | ||
s7 = peg$parsepatch(); | ||
} | ||
if (s7 === peg$FAILED) { | ||
s7 = null; | ||
@@ -681,0 +693,0 @@ } |
{ | ||
"name": "what-the-diff", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "diff parsing library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,3 +19,3 @@ # JavaScript Diff Parser | ||
```javascript | ||
let parse = require('what-the-diff') | ||
let {parse} = require('what-the-diff') | ||
@@ -22,0 +22,0 @@ var str = `diff --git file.txt file.txt |
@@ -489,2 +489,8 @@ var diff = require('../') | ||
Binary files three.gif and /dev/null differ | ||
diff --git a/cat.png b/cat.png | ||
new file mode 100644 | ||
index 0000000..8b8dc61 | ||
--- /dev/null | ||
+++ b/cat.png | ||
Binary files differ | ||
` | ||
@@ -521,2 +527,11 @@ | ||
}, | ||
{ | ||
oldPath: null, | ||
newPath: 'b/cat.png', | ||
hunks: [], | ||
oldMode: null, | ||
newMode: '100644', | ||
status: 'added', | ||
binary: true | ||
} | ||
]) | ||
@@ -526,2 +541,24 @@ test.done() | ||
exports.testBinaryFilesRename = function(test) { | ||
var str = dedent` | ||
diff --git a/dir_a/one.png b/dir_b/one.png | ||
similarity index 100% | ||
rename from dir_a/one.png | ||
rename to dir_b/one.png | ||
Binary files differ | ||
` | ||
const output = diff.parse(str) | ||
assert.deepEqual(output, [ | ||
{ | ||
oldPath: 'dir_a/one.png', | ||
newPath: 'dir_b/one.png', | ||
hunks: undefined, | ||
status: 'renamed', | ||
similarity: 100 | ||
} | ||
]) | ||
test.done() | ||
} | ||
exports.testNoPatch = function(test) { | ||
@@ -528,0 +565,0 @@ var str = dedent` |
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
79642
2654