( reportError: (e: Error) => void, object: T, supportedProperties: string[], name?: string )
| 218 | * @deprecated verifyObjectMatchesProto will be replacing this soon. |
| 219 | */ |
| 220 | export function checkExcessProperties<T>( |
| 221 | reportError: (e: Error) => void, |
| 222 | object: T, |
| 223 | supportedProperties: string[], |
| 224 | name?: string |
| 225 | ) { |
| 226 | const extraProperties = Object.keys(object).filter( |
| 227 | key => !(supportedProperties as string[]).includes(key) |
| 228 | ); |
| 229 | if (extraProperties.length > 0) { |
| 230 | reportError( |
| 231 | new Error( |
| 232 | `Unexpected property "${extraProperties[0]}"${!!name ? ` in ${name}` : "" |
| 233 | }. Supported properties are: ${JSON.stringify(supportedProperties)}` |
| 234 | ) |
| 235 | ); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | export function validateQueryString(session: Session, query: string, filename: string) { |
| 240 | if (query?.trim().slice(-1) === ";") { |
no test coverage detected