File size: 563 Bytes
d9494a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { isNonEmptyString } from '@sniptt/guards';

import { isRecordObjectSchema } from '@/logic-function/is-record-object-schema';

type RecordArraySchema = {
  type?: string;
  objectUniversalIdentifier?: string;
  items?: {
    type?: string;
    objectUniversalIdentifier?: string;
  } | null;
};

export const isRecordArraySchema = (
  schema: RecordArraySchema | null | undefined,
): boolean =>
  (schema?.type === 'records' &&
    isNonEmptyString(schema.objectUniversalIdentifier)) ||
  (schema?.type === 'array' && isRecordObjectSchema(schema?.items));