Skip to content

Commit e085a53

Browse files
committed
Add additional docs on expandObjectPaths subtleties
1 parent adee9b2 commit e085a53

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/jasmine/tests/lib_test.js

+21
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,27 @@ describe('Test lib.js:', function() {
592592
// not data arrays but yes on arrays that were previously expanded. This is a bit
593593
// tricky to get to work just right and currently doesn't have any known use since
594594
// container arrays are not multiply nested.
595+
//
596+
// Additional notes on what works or what doesn't work. This case does *not* work
597+
// because the two nested arrays that would result from the expansion need to be
598+
// deep merged.
599+
//
600+
// Lib.expandObjectPaths({'marker.range[0]': 5, 'marker.range[1]': 2})
601+
//
602+
// // => {marker: {range: [null, 2]}}
603+
//
604+
// This case *does* work becuase the array merging does not require a deep extend:
605+
//
606+
// Lib.expandObjectPaths({'range[0]': 5, 'range[1]': 2}
607+
//
608+
// // => {range: [5, 2]}
609+
//
610+
// Finally note that this case works fine becuase there's no merge necessary:
611+
//
612+
// Lib.expandObjectPaths({'marker.range[1]': 2})
613+
//
614+
// // => {marker: {range: [null, 2]}}
615+
//
595616
/*
596617
it('combines changes', function() {
597618
var input = {'marker[1].range[1]': 5, 'marker[1].range[0]': 4};

0 commit comments

Comments
 (0)