Open In App

Node.js process.noDeprecation Property

Last Updated : 11 Jun, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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




// Node.js program to demonstrate the
// process.noDeprecation Property
  
// Include process module
const process = require('process');
  
// Printing process.noDeprecation property value
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




// Node.js program to demonstrate the
// process.noDeprecation Property
  
// Include process module
const process = require('process');
  
// Instance Properties
process.noDeprecation = false;
  
// Printing process.noDeprecation property value
console.log(process.noDeprecation);
  
// Instance Properties
process.noDeprecation = true;
  
// Printing process.noDeprecation property value
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



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads