mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 10:30:09 +00:00
docs + some tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1d1bbea23d
commit
3ffbe78f57
@ -282,7 +282,9 @@ The `path` is a `"/"` or `"\"` separated string that supports the following item
|
||||
*Note that `"**"` is a special case in that it can not be combined with other patterns above (e.g. in `"a|**"` the string `"**"` is treated literally and has not special meaning).*
|
||||
|
||||
`diff.merge(diff) -> diff`
|
||||
XXX
|
||||
Generate a merged *diff* containing the changes from both diff object.
|
||||
|
||||
*Note that this method currently simply concatenates the changes of two diff objects together, at this point no effort is made to optimize the new change list (changes can be redundant or canceling but there should not be any conflicts unless a merged diff is missing or is out of order).*
|
||||
|
||||
`diff.end() -> diff`
|
||||
Return the *parent diff* that was used to generate the current *child diff* or the current diff if there is not parent.
|
||||
|
||||
13
diff.js
13
diff.js
@ -2180,6 +2180,16 @@ var DiffClassPrototype = {
|
||||
// ...currently the context for most things is .constructor.types
|
||||
// which is global this makes anything that any handler does not
|
||||
// local to a particular diff instance...
|
||||
// XXX patching should be possible with a simple empty object...
|
||||
// ...not sure how to create the path elements though...
|
||||
// this would make optimizing .merge(..) simple:
|
||||
// var diff = x.merge(y)
|
||||
// // reference -- the unchanged section of the input...
|
||||
// var pre = diff
|
||||
// .reverse()
|
||||
// .patch()
|
||||
// var post = diff.patch(ref)
|
||||
// var optimized = Diff(pre, post)
|
||||
var DiffPrototype = {
|
||||
// system meta information...
|
||||
get format(){
|
||||
@ -2197,6 +2207,7 @@ var DiffPrototype = {
|
||||
placeholders: null,
|
||||
options: null,
|
||||
diff: null,
|
||||
timestamp: null,
|
||||
|
||||
parent: null,
|
||||
|
||||
@ -2220,6 +2231,8 @@ var DiffPrototype = {
|
||||
: options.tree_diff ?
|
||||
diff.diff(A, B, options)
|
||||
: diff.flatten(diff.diff(A, B, options), options)
|
||||
|
||||
this.timestamp = Date.now()
|
||||
},
|
||||
|
||||
// XXX should this be a deep copy???
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user