prototype-helper
Advanced tools
Comparing version 0.2.1 to 0.2.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const consola = require("consola"); | ||
function getTime() { | ||
const nowDate = new Date(); | ||
return `${nowDate.getHours()}:${nowDate.getMinutes()}:${nowDate.getSeconds()}:${`${nowDate.getMilliseconds()}`.padStart(3, "0")}`; | ||
} | ||
console.option = { | ||
development: { | ||
log: true, | ||
info: true, | ||
warn: true, | ||
error: true, | ||
}, | ||
production: { | ||
log: false, | ||
info: false, | ||
warn: true, | ||
error: true, | ||
}, | ||
}; | ||
function showMessage(type, ...message) { | ||
consola[type](`\x1b[2m[${getTime()}]\x1b[0m\x1b[37m`, ...message); | ||
} | ||
console.show = console.log.bind(this); | ||
console.log = function (...message) { | ||
// if ( | ||
// (process.env.NODE_ENV === "development" && console.option.development.log) || | ||
// (process.env.NODE_ENV === "production" && console.option.production.log) | ||
// ) | ||
showMessage("info", ...message); | ||
}; | ||
console.info = function (...message) { | ||
// if ( | ||
// (process.env.NODE_ENV === "development" && console.option.development.info) || | ||
// (process.env.NODE_ENV === "production" && console.option.production.info) | ||
// ) | ||
showMessage("info", ...message); | ||
}; | ||
console.warn = function (...message) { | ||
// if ( | ||
// (process.env.NODE_ENV === "development" && console.option.development.warn) || | ||
// (process.env.NODE_ENV === "production" && console.option.production.warn) | ||
// ) | ||
showMessage("warn", ...message); | ||
}; | ||
console.error = function (...message) { | ||
// if ( | ||
// (process.env.NODE_ENV === "development" && console.option.development.error) || | ||
// (process.env.NODE_ENV === "production" && console.option.production.error) | ||
// ) | ||
showMessage("error", ...message); | ||
}; | ||
globalThis.console = console; | ||
// export {}; | ||
// const consola = require("consola"); | ||
// interface ConsoleShowOption { | ||
// log: boolean; | ||
// info: boolean; | ||
// warn: boolean; | ||
// error: boolean; | ||
// } | ||
// interface ConsoleOption { | ||
// development: ConsoleShowOption; | ||
// production: ConsoleShowOption; | ||
// } | ||
// declare global { | ||
// interface Console { | ||
// option: ConsoleOption; | ||
// show(message?: any, ...optionalParams: any[]): void; | ||
// } | ||
// } | ||
// function getTime() { | ||
// const nowDate = new Date(); | ||
// return `${nowDate.getHours()}:${nowDate.getMinutes()}:${nowDate.getSeconds()}:${`${nowDate.getMilliseconds()}`.padStart( | ||
// 3, | ||
// "0" | ||
// )}`; | ||
// } | ||
// console.option = { | ||
// development: { | ||
// log: true, | ||
// info: true, | ||
// warn: true, | ||
// error: true, | ||
// }, | ||
// production: { | ||
// log: false, | ||
// info: false, | ||
// warn: true, | ||
// error: true, | ||
// }, | ||
// }; | ||
// function showMessage(type: "info" | "warn" | "error", ...message: any) { | ||
// consola[type](`\x1b[2m[${getTime()}]\x1b[0m\x1b[37m`, ...message); | ||
// } | ||
// console.show = console.log.bind(this); | ||
// console.log = function (...message: any) { | ||
// // if ( | ||
// // (process.env.NODE_ENV === "development" && console.option.development.log) || | ||
// // (process.env.NODE_ENV === "production" && console.option.production.log) | ||
// // ) | ||
// showMessage("info", ...message); | ||
// }; | ||
// console.info = function (...message: any) { | ||
// // if ( | ||
// // (process.env.NODE_ENV === "development" && console.option.development.info) || | ||
// // (process.env.NODE_ENV === "production" && console.option.production.info) | ||
// // ) | ||
// showMessage("info", ...message); | ||
// }; | ||
// console.warn = function (...message: any) { | ||
// // if ( | ||
// // (process.env.NODE_ENV === "development" && console.option.development.warn) || | ||
// // (process.env.NODE_ENV === "production" && console.option.production.warn) | ||
// // ) | ||
// showMessage("warn", ...message); | ||
// }; | ||
// console.error = function (...message: any) { | ||
// // if ( | ||
// // (process.env.NODE_ENV === "development" && console.option.development.error) || | ||
// // (process.env.NODE_ENV === "production" && console.option.production.error) | ||
// // ) | ||
// showMessage("error", ...message); | ||
// }; | ||
// globalThis.console = console; | ||
//# sourceMappingURL=console.js.map |
{ | ||
"name": "prototype-helper", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"private": false, | ||
@@ -25,3 +25,2 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"consola": "^2.15.3", | ||
"decimal.js": "^10.3.1" | ||
@@ -28,0 +27,0 @@ }, |
Sorry, the diff of this file is not supported yet
1
563
43734
- Removedconsola@^2.15.3
- Removedconsola@2.15.3(transitive)