MCPcopy
hub / github.com/webpack/webpack-dev-server / normalizeOptions

Function normalizeOptions

test/helpers/normalize-options.js:5–37  ·  view source on GitHub ↗

* @param {import("https").ServerOptions} options server options * @returns {Record } normalized server options

(options)

Source from the content-addressed store, hash-verified

3 * @returns {Record<string, string | string[] | boolean>} normalized server options
4 */
5function normalizeOptions(options) {
6 const normalizedOptions = {};
7
8 for (const propertyName in options) {
9 let value = options[propertyName];
10
11 if (Array.isArray(value)) {
12 value = value.map((item) => {
13 if (Buffer.isBuffer(item)) {
14 return "<Buffer>";
15 } else if (
16 typeof item.pem !== "undefined" &&
17 Buffer.isBuffer(item.pem)
18 ) {
19 item.pem = "<Buffer>";
20 } else if (
21 typeof item.buf !== "undefined" &&
22 Buffer.isBuffer(item.buf)
23 ) {
24 item.buf = "<Buffer>";
25 }
26
27 return item;
28 });
29 } else if (Buffer.isBuffer(value)) {
30 value = "<Buffer>";
31 }
32
33 normalizedOptions[propertyName] = value;
34 }
35
36 return normalizedOptions;
37}
38
39export default normalizeOptions;

Callers 1

server.test.jsFile · 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…