decorateConstructor() — fastify Function Reference
Architecture documentation for the decorateConstructor() function in decorate.js from the fastify codebase.
Entity Profile
Dependency Diagram
graph TD 8e5a8605_9ce7_799e_064b_2022f3777b88["decorateConstructor()"] b5b3567f_29bc_3ac4_2dcc_eba5eeb01c3e["decorate.js"] 8e5a8605_9ce7_799e_064b_2022f3777b88 -->|defined in| b5b3567f_29bc_3ac4_2dcc_eba5eeb01c3e 81317479_062a_0436_b10a_76847ed5ed35["decorateReply()"] 81317479_062a_0436_b10a_76847ed5ed35 -->|calls| 8e5a8605_9ce7_799e_064b_2022f3777b88 c684bbc2_2367_f120_4e02_eaf31217d62b["decorateRequest()"] c684bbc2_2367_f120_4e02_eaf31217d62b -->|calls| 8e5a8605_9ce7_799e_064b_2022f3777b88 11692e5b_f016_8497_4047_012d2b7bdd24["hasKey()"] 8e5a8605_9ce7_799e_064b_2022f3777b88 -->|calls| 11692e5b_f016_8497_4047_012d2b7bdd24 7d734264_83ae_0f9a_4ed9_57cba3726f85["checkDependencies()"] 8e5a8605_9ce7_799e_064b_2022f3777b88 -->|calls| 7d734264_83ae_0f9a_4ed9_57cba3726f85 style 8e5a8605_9ce7_799e_064b_2022f3777b88 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
lib/decorate.js lines 48–67
function decorateConstructor (konstructor, name, fn, dependencies) {
const instance = konstructor.prototype
if (Object.hasOwn(instance, name) || hasKey(konstructor, name)) {
throw new FST_ERR_DEC_ALREADY_PRESENT(name)
}
konstructor[kHasBeenDecorated] = true
checkDependencies(konstructor, name, dependencies)
if (fn && (typeof fn.getter === 'function' || typeof fn.setter === 'function')) {
Object.defineProperty(instance, name, {
get: fn.getter,
set: fn.setter
})
} else if (typeof fn === 'function') {
instance[name] = fn
} else {
konstructor.props.push({ key: name, value: fn })
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does decorateConstructor() do?
decorateConstructor() is a function in the fastify codebase, defined in lib/decorate.js.
Where is decorateConstructor() defined?
decorateConstructor() is defined in lib/decorate.js at line 48.
What does decorateConstructor() call?
decorateConstructor() calls 2 function(s): checkDependencies, hasKey.
What calls decorateConstructor()?
decorateConstructor() is called by 2 function(s): decorateReply, decorateRequest.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free