(value: unknown, context: string)
| 120 | } |
| 121 | |
| 122 | function parseResource(value: unknown, context: string): MothershipResource { |
| 123 | assertValid(isRecordLike(value), `${context} must be an object`) |
| 124 | assertValid(isResourceType(value.type), `${context}.type is invalid`) |
| 125 | assertValid(typeof value.id === 'string', `${context}.id must be a string`) |
| 126 | assertValid(typeof value.title === 'string', `${context}.title must be a string`) |
| 127 | |
| 128 | return { |
| 129 | type: value.type, |
| 130 | id: value.id, |
| 131 | title: value.title, |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | function parseResources(value: unknown, context: string): MothershipResource[] { |
| 136 | assertValid(Array.isArray(value), `${context} must be an array`) |
no test coverage detected