@lint-todo/utils
Version:
 [](https://badge.fury.io/js/%40lint-todo%2Futils) [](h
23 lines • 869 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSeverity = void 0;
const date_utils_1 = require("./date-utils");
const types_1 = require("./types");
/**
* Returns the correct severity level based on the todo data's decay dates.
*
* @param todo - The todo data.
* @param today - A number representing a date (UNIX Epoch - milliseconds)
* @returns Severity - the lint severity based on the evaluation of the decay dates.
*/
function getSeverity(todo, today = (0, date_utils_1.getDatePart)().getTime()) {
if ((0, date_utils_1.isExpired)(todo.errorDate, today)) {
return types_1.Severity.error;
}
else if ((0, date_utils_1.isExpired)(todo.warnDate)) {
return types_1.Severity.warn;
}
return types_1.Severity.todo;
}
exports.getSeverity = getSeverity;
//# sourceMappingURL=get-severity.js.map