Your development workspace
This app is private. Sign in with your authorized Google account.
In Node-facing code and mock factories, avoid using module, exports or require as local names for unrelated values. Name an imported namespace mod or use a descriptive domain name so it cannot be confused with the host module-system binding.
| 1 | async function copyNamespace(loadOriginal: () => Promise<Record<string, unknown>>) { |
| 2 | const module = await loadOriginal(); |
| 3 | return { ...module }; |
| 4 | } |
Explanation (EN)
The local name looks like the familiar CommonJS module binding even though it stores an unrelated imported namespace.
Objašnjenje (HR)
Lokalno ime izgleda kao poznati CommonJS module iako drzi drugi namespace.
| 1 | async function copyNamespace(loadOriginal: () => Promise<Record<string, unknown>>) { |
| 2 | const mod = await loadOriginal(); |
| 3 | return { ...mod }; |
| 4 | } |
Explanation (EN)
A short namespace name avoids the misleading module-system association without changing behavior.
Objašnjenje (HR)
Kratko ime namespacea uklanja zabunu bez promjene ponasanja.
This is naming guidance, not a claim that module is an ECMAScript reserved keyword or that the original ESM code is invalid. Node CommonJS supplies module, exports and require through its module wrapper. Verify whether the name is the actual runtime binding or an unrelated local value. Primary reference: https://nodejs.org/api/modules.html#the-module-wrapper .
Ovo je smjernica za imena, a ne tvrdnja da je module rezervirana ECMAScript kljucna rijec ili da izvorni ESM kod nije valjan. Razlikuj stvarni CommonJS binding od nepovezane lokalne vrijednosti.
Keep canonical names when intentionally accessing or configuring the real CommonJS module, exports or require bindings. Do not rename public API fields or namespace members solely because they share these spellings.
Zadrzi kanonska imena pri namjernom pristupu stvarnim CommonJS bindingima. Ne preimenuj javna API polja ili clanove namespacea samo zbog istog zapisa.
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).