(params, maxParam, errClass)
| 105 | } |
| 106 | |
| 107 | function validateParams(params, maxParam, errClass) { |
| 108 | if (params === undefined) return; |
| 109 | if (typeof params !== 'object' || params === null) { |
| 110 | throw new ERR_INVALID_ARG_TYPE('options.params', 'Object', params); |
| 111 | } |
| 112 | const keys = ObjectKeys(params); |
| 113 | for (let i = 0; i < keys.length; i++) { |
| 114 | const origKey = keys[i]; |
| 115 | const key = +origKey; |
| 116 | if (NumberIsNaN(key) || key < 0 || key > maxParam) { |
| 117 | throw new errClass(origKey); |
| 118 | } |
| 119 | const value = params[origKey]; |
| 120 | if (typeof value !== 'number' && typeof value !== 'boolean') { |
| 121 | throw new ERR_INVALID_ARG_TYPE('options.params[key]', 'number', value); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | // --------------------------------------------------------------------------- |
| 127 | // Brotli / Zstd parameter arrays (computed once, reused per init call). |
no outgoing calls
no test coverage detected
searching dependent graphs…