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

Function getDeprecationWarningEmitter

lib/internal/util.js:113–136  ·  view source on GitHub ↗
(
  code, msg, deprecated, useEmitSync,
  shouldEmitWarning = () => true,
)

Source from the content-addressed store, hash-verified

111let validateOneOf;
112
113function getDeprecationWarningEmitter(
114 code, msg, deprecated, useEmitSync,
115 shouldEmitWarning = () => true,
116) {
117 let warned = false;
118 return function(arg) {
119 if (!warned && shouldEmitWarning(arg)) {
120 warned = true;
121 if (code === 'ExperimentalWarning') {
122 process.emitWarning(msg, code, deprecated);
123 } else if (code !== undefined) {
124 if (!codesWarned.has(code)) {
125 const emitWarning = useEmitSync ?
126 require('internal/process/warning').emitWarningSync :
127 process.emitWarning;
128 emitWarning(msg, 'DeprecationWarning', code, deprecated);
129 codesWarned.add(code);
130 }
131 } else {
132 process.emitWarning(msg, 'DeprecationWarning', deprecated);
133 }
134 }
135 };
136}
137
138function isPendingDeprecation() {
139 return getOptionValue('--pending-deprecation') &&

Callers 8

deprecatePropertyFunction · 0.85
pendingDeprecateFunction · 0.85
deprecateFunction · 0.85
deprecateInstantiationFunction · 0.85
keys.jsFile · 0.85
hash.jsFile · 0.85
loader.jsFile · 0.85
adapters.jsFile · 0.85

Calls 4

emitWarningFunction · 0.85
hasMethod · 0.65
addMethod · 0.65
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…