@@ -558,7 +558,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
558
558
CoreSchemaRegistry . _set (
559
559
data ,
560
560
pathFragments ,
561
- answers [ path ] as { } ,
561
+ answers [ path ] ,
562
562
null ,
563
563
undefined ,
564
564
true ,
@@ -567,51 +567,22 @@ export class CoreSchemaRegistry implements SchemaRegistry {
567
567
}
568
568
569
569
private static _set (
570
- // tslint:disable-next-line:no-any
570
+ // tslint:disable-next-line: no-any
571
571
data : any ,
572
572
fragments : string [ ] ,
573
- value : { } ,
574
- // tslint:disable-next-line:no-any
575
- parent : any | null = null ,
573
+ value : unknown ,
574
+ parent : Record < string , unknown > | null = null ,
576
575
parentProperty ?: string ,
577
576
force ?: boolean ,
578
577
) : void {
579
- for ( let i = 0 ; i < fragments . length ; i ++ ) {
580
- const f = fragments [ i ] ;
581
-
582
- if ( f [ 0 ] == 'i' ) {
583
- if ( ! Array . isArray ( data ) ) {
584
- return ;
585
- }
586
-
587
- for ( let j = 0 ; j < data . length ; j ++ ) {
588
- CoreSchemaRegistry . _set ( data [ j ] , fragments . slice ( i + 1 ) , value , data , '' + j ) ;
589
- }
590
-
591
- return ;
592
- }
593
-
594
- if ( f . startsWith ( 'key' ) ) {
595
- if ( typeof data !== 'object' ) {
596
- return ;
597
- }
598
-
599
- for ( const property in data ) {
600
- CoreSchemaRegistry . _set ( data [ property ] , fragments . slice ( i + 1 ) , value , data , property ) ;
601
- }
602
-
603
- return ;
604
- }
605
-
606
-
607
- // We know we need an object because the fragment is a property key.
578
+ for ( const fragment of fragments ) {
608
579
if ( ! data && parent !== null && parentProperty ) {
609
580
data = parent [ parentProperty ] = { } ;
610
581
}
611
- parent = data ;
612
- parentProperty = f ;
613
582
614
- data = data [ f ] ;
583
+ parent = data ;
584
+ parentProperty = fragment ;
585
+ data = data [ fragment ] ;
615
586
}
616
587
617
588
if ( parent && parentProperty && ( force || parent [ parentProperty ] === undefined ) ) {
0 commit comments