@@ -360,6 +360,31 @@ export const isObjectArrayControl = and(
360360 schemaSubPathMatches ( 'items' , schema => schema . type === 'object' )
361361) ;
362362
363+ const traverse = (
364+ any : JsonSchema | JsonSchema [ ] ,
365+ pred : ( obj : JsonSchema ) => boolean
366+ ) : boolean => {
367+ if ( _ . isArray ( any ) ) {
368+ return _ . reduce ( any , ( acc , el ) => acc || traverse ( el , pred ) , false ) ;
369+ }
370+
371+ if ( pred ( any ) ) {
372+ return true ;
373+ }
374+ if ( any . items ) {
375+ return traverse ( any . items , pred ) ;
376+ }
377+ if ( any . properties ) {
378+ return _ . reduce (
379+ _ . toPairs ( any . properties ) ,
380+ ( acc , [ _key , val ] ) => acc || traverse ( val , pred ) ,
381+ false
382+ ) ;
383+ }
384+
385+ return false ;
386+ } ;
387+
363388export const isObjectArrayWithNesting = (
364389 uischema : UISchemaElement ,
365390 schema : JsonSchema
@@ -412,31 +437,6 @@ export const isObjectArrayWithNesting = (
412437 return false ;
413438} ;
414439
415- const traverse = (
416- any : JsonSchema | JsonSchema [ ] ,
417- pred : ( obj : JsonSchema ) => boolean
418- ) : boolean => {
419- if ( _ . isArray ( any ) ) {
420- return _ . reduce ( any , ( acc , el ) => acc || traverse ( el , pred ) , false ) ;
421- }
422-
423- if ( pred ( any ) ) {
424- return true ;
425- }
426- if ( any . items ) {
427- return traverse ( any . items , pred ) ;
428- }
429- if ( any . properties ) {
430- return _ . reduce (
431- _ . toPairs ( any . properties ) ,
432- ( acc , [ _key , val ] ) => acc || traverse ( val , pred ) ,
433- false
434- ) ;
435- }
436-
437- return false ;
438- } ;
439-
440440/**
441441 * Synonym for isObjectArrayControl
442442 */
0 commit comments