Node.js process.noDeprecation Property
Last Updated :
11 Jun, 2021
The process.noDeprecation property is an inbuilt application programming interface of the process module which is used to indicates whether the –no-deprecation flag is set on the current Node.js process. A Boolean that controls whether or not deprecation warnings are printed to stderr. Setting this to true will silence deprecation warnings. This property is used instead of the –no-deprecation command line flag.
Syntax:
process.noDeprecation
Return Value: This property indicates whether the –no-deprecation flag is set on the current Node.js process.
Below examples illustrate the use of process.noDeprecation property in Node.js:
Example 1:
Javascript
const process = require( 'process' );
console.log(process.noDeprecation);
|
Command to run: node –no-deprecation hello.js
Output:
true
Command to run:node hello.js
Output:
undefined
Example 2:
Javascript
const process = require( 'process' );
process.noDeprecation = false ;
console.log(process.noDeprecation);
process.noDeprecation = true ;
console.log(process.noDeprecation);
|
Command to run: node –no-deprecation hello.js
Output:
true
true
Command to run:node hello.js
Output:
false
true
Reference: https://nodejs.org/api/process.html#process_process_nodeprecation
Share your thoughts in the comments
Please Login to comment...