* Validates the encoding options. * @param {ClientOptions.encoding} encodingOptions * @private
(encodingOptions)
| 281 | * @private |
| 282 | */ |
| 283 | function validateEncodingOptions(encodingOptions) { |
| 284 | if (encodingOptions.map) { |
| 285 | const mapConstructor = encodingOptions.map; |
| 286 | if (typeof mapConstructor !== 'function' || |
| 287 | typeof mapConstructor.prototype.forEach !== 'function' || |
| 288 | typeof mapConstructor.prototype.set !== 'function') { |
| 289 | throw new TypeError('Map constructor not valid'); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | if (encodingOptions.set) { |
| 294 | const setConstructor = encodingOptions.set; |
| 295 | if (typeof setConstructor !== 'function' || |
| 296 | typeof setConstructor.prototype.forEach !== 'function' || |
| 297 | typeof setConstructor.prototype.add !== 'function') { |
| 298 | throw new TypeError('Set constructor not valid'); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | if ((encodingOptions.useBigIntAsLong || encodingOptions.useBigIntAsVarint) && typeof BigInt === 'undefined') { |
| 303 | throw new TypeError('BigInt is not supported by the JavaScript engine'); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | function validateApplicationInfo(options) { |
| 308 | function validateString(key) { |