MCPcopy Index your code
hub / github.com/nodejs/node / validateParams

Function validateParams

lib/internal/streams/iter/transform.js:107–124  ·  view source on GitHub ↗
(params, maxParam, errClass)

Source from the content-addressed store, hash-verified

105}
106
107function 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).

Callers 2

createBrotliHandleFunction · 0.85
createZstdHandleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…