mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 11:00:12 +00:00
tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
69c37f5dbf
commit
1013af0e47
11
diff.js
11
diff.js
@ -134,8 +134,7 @@ var getCommonSections = function(A, B, cmp, min_chunk){
|
|||||||
// cache...
|
// cache...
|
||||||
var res = (cache[a] || [])[b]
|
var res = (cache[a] || [])[b]
|
||||||
if(res != null){
|
if(res != null){
|
||||||
return res
|
return res }
|
||||||
}
|
|
||||||
|
|
||||||
// collect common chunk...
|
// collect common chunk...
|
||||||
var chunk = {
|
var chunk = {
|
||||||
@ -145,10 +144,10 @@ var getCommonSections = function(A, B, cmp, min_chunk){
|
|||||||
}
|
}
|
||||||
var l = chunk.length
|
var l = chunk.length
|
||||||
while((a+l < A.length && b+l < B.length)
|
while((a+l < A.length && b+l < B.length)
|
||||||
// cmp non-empty slots only...
|
// cmp non-empty slots only...
|
||||||
&& ((a+l in A && b+l in B) ?
|
&& ((a+l in A && b+l in B) ?
|
||||||
cmp(A[a+l], B[b+l])
|
cmp(A[a+l], B[b+l])
|
||||||
: (!(a+l in A) && !(b+l in B)))){
|
: (!(a+l in A) && !(b+l in B)))){
|
||||||
l = chunk.length += 1 }
|
l = chunk.length += 1 }
|
||||||
// ignore small chunks...
|
// ignore small chunks...
|
||||||
l = chunk.length >= min_chunk ?
|
l = chunk.length >= min_chunk ?
|
||||||
|
|||||||
9
diff2.js
9
diff2.js
@ -80,6 +80,7 @@ module.HANDLERS = {
|
|||||||
|
|
||||||
// Functions...
|
// Functions...
|
||||||
//
|
//
|
||||||
|
// XXX EXPERIMENTAL...
|
||||||
// XXX STUB...
|
// XXX STUB...
|
||||||
func: {
|
func: {
|
||||||
match: function(obj){
|
match: function(obj){
|
||||||
@ -260,6 +261,7 @@ function(obj, handlers=module.HANDLERS){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
// Format:
|
// Format:
|
||||||
// [
|
// [
|
||||||
// [<path>, {type: <name>}],
|
// [<path>, {type: <name>}],
|
||||||
@ -269,6 +271,7 @@ function(obj, handlers=module.HANDLERS){
|
|||||||
// [<path>, <value>],
|
// [<path>, <value>],
|
||||||
// ]
|
// ]
|
||||||
//
|
//
|
||||||
|
// XXX add a tree mode -- containers as levels...
|
||||||
// XXX need a way to index the path...
|
// XXX need a way to index the path...
|
||||||
// ...and to filter paths by pattern...
|
// ...and to filter paths by pattern...
|
||||||
// XXX might be a good idea to generate "structural hashes" for objects...
|
// XXX might be a good idea to generate "structural hashes" for objects...
|
||||||
@ -407,6 +410,12 @@ function(...attrs){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// XXX construct...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// XXX move to test...
|
// XXX move to test...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user