mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 18:40:09 +00:00
experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
bf849bb2d4
commit
2fcb8f9863
20
diff2.js
20
diff2.js
@ -405,10 +405,29 @@ module.WALK_HANDLERS = {
|
|||||||
return obj instanceof Map
|
return obj instanceof Map
|
||||||
&& obj.entries() } },
|
&& obj.entries() } },
|
||||||
|
|
||||||
|
/* XXX should we handle array elements differently???
|
||||||
|
// ...these to simply mark attr type for the handler(..), not
|
||||||
|
// sure if the added complexity is worth it... (???)
|
||||||
|
array: {
|
||||||
|
walk: function(obj){
|
||||||
|
return obj instanceof Array
|
||||||
|
&& [...Object.entries(obj)]
|
||||||
|
.filter(function(e){
|
||||||
|
return !isNaN(parseInt(e)) }) }},
|
||||||
|
attr: {
|
||||||
|
walk: function(obj){
|
||||||
|
return obj instanceof Array ?
|
||||||
|
[...Object.entries(obj)]
|
||||||
|
.filter(function(e){
|
||||||
|
return isNaN(parseInt(e)) })
|
||||||
|
: typeof(obj) == 'object'
|
||||||
|
&& [...Object.entries(obj)] } },
|
||||||
|
/*/
|
||||||
attr: {
|
attr: {
|
||||||
walk: function(obj){
|
walk: function(obj){
|
||||||
return typeof(obj) == 'object'
|
return typeof(obj) == 'object'
|
||||||
&& [...Object.entries(obj)] } },
|
&& [...Object.entries(obj)] } },
|
||||||
|
//*/
|
||||||
proto: {
|
proto: {
|
||||||
walk: function(obj){
|
walk: function(obj){
|
||||||
return typeof(obj) == 'object'
|
return typeof(obj) == 'object'
|
||||||
@ -431,6 +450,7 @@ module.WALK_HANDLERS = {
|
|||||||
// -> <value>
|
// -> <value>
|
||||||
// !> STOP(<value>)
|
// !> STOP(<value>)
|
||||||
//
|
//
|
||||||
|
// Link handling...
|
||||||
// <handler>(<obj>, <path>, <orig-path>, 'LINK')
|
// <handler>(<obj>, <path>, <orig-path>, 'LINK')
|
||||||
// -> <value>
|
// -> <value>
|
||||||
// !> STOP(<value>)
|
// !> STOP(<value>)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user