(schema: JSONSchema)
| 37 | } |
| 38 | |
| 39 | export function isNeverSchema(schema: JSONSchema): boolean { |
| 40 | // Boolean `false` is the shorthand never-schema |
| 41 | if (schema === false) { |
| 42 | return true |
| 43 | } |
| 44 | |
| 45 | if (typeof schema === 'object' && schema.not !== undefined) { |
| 46 | // `{ not: true }` — negation of the boolean catch-all |
| 47 | if (schema.not === true) { |
| 48 | return true |
| 49 | } |
| 50 | |
| 51 | // `{ not: {} }` — negation of the empty object, which accepts everything |
| 52 | if (typeof schema.not === 'object' && Object.keys(schema.not).length === 0) { |
| 53 | return true |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | return false |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @internal |
no outgoing calls
no test coverage detected