File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
packages/compass-collection/src/modules Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -721,21 +721,11 @@ const validateFakerSchema = (
721
721
const { fakerMethod } = field ;
722
722
723
723
// validate faker method
724
- const methodSegments = fakerMethod . split ( '.' ) ;
725
- let methodRef : any = faker ;
726
- for ( const segment of methodSegments ) {
727
- if (
728
- methodRef &&
729
- typeof methodRef === 'object' &&
730
- segment in methodRef
731
- ) {
732
- methodRef = methodRef [ segment ] ;
733
- } else {
734
- methodRef = undefined ;
735
- break ;
736
- }
737
- }
738
- if ( typeof methodRef !== 'function' ) {
724
+ const [ moduleName , methodName , ...rest ] = fakerMethod . split ( '.' ) ;
725
+ if (
726
+ rest . length > 0 ||
727
+ typeof ( faker as any ) [ moduleName ] ?. [ methodName ] !== 'function'
728
+ ) {
739
729
logger . log . warn (
740
730
mongoLogId ( 1_001_000_372 ) ,
741
731
'Collection' ,
You can’t perform that action at this time.
0 commit comments