MCPcopy
hub / github.com/fastify/fastify / deepFreezeObject

Function deepFreezeObject

lib/initial-config-validation.js:19–33  ·  view source on GitHub ↗
(object)

Source from the content-addressed store, hash-verified

17}
18
19function deepFreezeObject (object) {
20 const properties = Object.getOwnPropertyNames(object)
21
22 for (const name of properties) {
23 const value = object[name]
24
25 if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {
26 continue
27 }
28
29 object[name] = value && typeof value === 'object' ? deepFreezeObject(value) : value
30 }
31
32 return Object.freeze(object)
33}
34
35module.exports = validateInitialConfig
36module.exports.defaultInitOptions = validate.defaultInitOptions

Callers 2

validateInitialConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected