UNPKG

logstack

Version:

Logstack is simple logger alternative to console.log which is written in specified file instead of terminal window.",

47 lines (38 loc) 986 B
exports.formatDate = function (date) { let year = date.getFullYear(); let month = "" + (date.getMonth() + 1); let day = "" + date.getDate(); if (month.length < 2) { month = '0' + month } if (day.length < 2) { day = '0' + day } return year + "-" + month + "-" + day; } exports.formatTime = function (date) { let hour = "" + date.getHours(); let minutes = "" + date.getMinutes(); if (hour.length < 2) hour = '0' + hour; if (minutes.length < 2) minutes = '0' + minutes; return hour + ':' + minutes; } exports.isNullOrEmpty = function (stringValue) { if (isString(stringValue)) { if (stringValue == null || stringValue == '') { return true; } } else { if (stringValue == null) { return true; } } return false; } function isString(object) { if (typeof object === 'string') { return true; } else { return false; } }