log-process-errors
Version:
Show some ❤️ to process errors
36 lines (13 loc) • 433 B
JavaScript
import process from"node:process";
export const removeWarningListener=()=>{
if(warningListener!==undefined){
process.off("warning",warningListener)
}
};
export const restoreWarningListener=()=>{
if(warningListener!==undefined&&getWarningListeners().length===0){
process.on("warning",warningListener)
}
};
const getWarningListeners=()=>process.listeners("warning");
const[warningListener]=getWarningListeners();