Node.js – process.noDeprecation() 方法
此 process.noDeprecation() 方法指出 --no- Deprecation 标志是否在当前 Node.js 项目中设置。此布尔标志控制是否将弃用警告消息打印到 stderr。将此标志设置为 True 会忽略所有弃用警告。
语法
process.noDeprecation( )
示例 1
创建一个名为 "noDeprecation.js" 的文件,并复制下列代码。创建文件后,使用命令 "node noDeprecation.js" 来运行此代码,如下例所示
// process.noDeprecation() Demo Example
// Importing the process module
const process = require('process');
// Printing noDeprecation default value
console.log(process.noDeprecation);输出 1
undefined
输出 2
true
示例 2
我们再举一个例子 −
// process.noDeprecation() Demo Example
// Importing the process module
const process = require('process');
// Initializing the noDeprecation flag
process.noDeprecation = false;
// Printing noDeprecation
console.log(process.noDeprecation);
// Initializing the noDeprecation flag
process.noDeprecation = true;
// Printing noDeprecation
console.log(process.noDeprecation);输出 1
false true
输出 2
true true
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP