mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 18:40:09 +00:00
notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
74cd12cd47
commit
30573a7939
4
diff2.js
4
diff2.js
@ -101,6 +101,7 @@ module.CONTENT =
|
|||||||
//
|
//
|
||||||
// XXX need to think about extension use-cases...
|
// XXX need to think about extension use-cases...
|
||||||
// XXX should we move this to a separate lib???
|
// XXX should we move this to a separate lib???
|
||||||
|
// XXX add a way to do relative/full paths...
|
||||||
var Walk =
|
var Walk =
|
||||||
module.Walk =
|
module.Walk =
|
||||||
object.Constructor('Walk', {
|
object.Constructor('Walk', {
|
||||||
@ -153,6 +154,7 @@ object.Constructor('Walk', {
|
|||||||
: Object.assign(
|
: Object.assign(
|
||||||
function*(){ yield handler.call(this, ...arguments) },
|
function*(){ yield handler.call(this, ...arguments) },
|
||||||
{toString: function(){ return handler.toString() }}) },
|
{toString: function(){ return handler.toString() }}) },
|
||||||
|
// XXX add options...
|
||||||
__call__: function*(_, obj, path=[], type='root', seen=new Map()){
|
__call__: function*(_, obj, path=[], type='root', seen=new Map()){
|
||||||
var that = this
|
var that = this
|
||||||
path = this.normalizePath ?
|
path = this.normalizePath ?
|
||||||
@ -197,6 +199,8 @@ object.Constructor('Walk', {
|
|||||||
yield* items
|
yield* items
|
||||||
.iter()
|
.iter()
|
||||||
.map(function*([key, value]){
|
.map(function*([key, value]){
|
||||||
|
// XXX add relative path support...
|
||||||
|
// ...maybe [path, key] instead of path.concat(key) ???
|
||||||
yield* that(value, path.concat(key), type, seen) }) })
|
yield* that(value, path.concat(key), type, seen) }) })
|
||||||
// handle STOP...
|
// handle STOP...
|
||||||
} catch(err){
|
} catch(err){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user