From dd0e00255622ab24ea9cf5d6da4b34f0a4c5388e Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 28 May 2021 16:53:17 +0300 Subject: [PATCH 1/3] notes... Signed-off-by: Alex A. Naanou --- diff2.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/diff2.js b/diff2.js index 8fc20e6..21df74c 100644 --- a/diff2.js +++ b/diff2.js @@ -94,6 +94,10 @@ module.HANDLERS = { }, // XXX do we need to treat array keys as a special case??? + // ...the best approach could be to simply: + // - prioretize handlers -- already done + // - skip repeating keys + // ...this could be done on the root handler level... // XXX need to optionally handle props... keys: { match: function(obj){ From 191b5ae174c460afc900c7c17a3253dba37d0668 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 28 May 2021 17:12:11 +0300 Subject: [PATCH 2/3] minor tweaks... Signed-off-by: Alex A. Naanou --- diff2.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/diff2.js b/diff2.js index 21df74c..b6f7844 100644 --- a/diff2.js +++ b/diff2.js @@ -234,6 +234,14 @@ var o = { object: { x: {}, }, + + array_with_attrs: Object.assign( + [1, 2, 3], + { + a: "some value", + // will overwrite 2... + 1: 333, + }) } // loop... o.object.y = o.object From 904a911bb15ae948fb211c63f514c681c71dde9e Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 28 May 2021 17:19:32 +0300 Subject: [PATCH 3/3] more notes... Signed-off-by: Alex A. Naanou --- diff2.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/diff2.js b/diff2.js index b6f7844..22d72be 100644 --- a/diff2.js +++ b/diff2.js @@ -136,6 +136,7 @@ function(obj, handlers=module.HANDLERS){ // XXX need a way to index the path... // ...and to filter paths by pattern... +// XXX need to generate object UIDs for use in paths etc... var handle = module.handle = function*(obj, path=[], options={}){ @@ -236,7 +237,8 @@ var o = { }, array_with_attrs: Object.assign( - [1, 2, 3], + // XXX should empty slots be marked in arrays??? + [1, 2, 3, , 5, 6], { a: "some value", // will overwrite 2...