import { AttributeType } from '../interfaces' import { schemas } from './schemas' export function simpleId(id: string): undefined | AttributeType { const refId = (id.replace('#', '').split('/').pop() || '').split('.').reverse().pop() || '' return !!refId && Object.prototype.hasOwnProperty.call(schemas, refId) ? (refId as AttributeType) : undefined } export function isBuiltInSchema(id: string): boolean { return !!simpleId(id) } export function builtInSchema(id: string): undefined | Record { const key = simpleId(id) return key && ((schemas as unknown) as Record)[key] }