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