UNPKG

@lint-todo/utils

Version:

![CI Build](https://github.com/lint-todo/utils/workflows/CI%20Build/badge.svg) [![npm version](https://badge.fury.io/js/%40lint-todo%2Futils.svg)](https://badge.fury.io/js/%40lint-todo%2Futils) [![License](https://img.shields.io/npm/l/@checkup/cli.svg)](h

23 lines 869 B
"use strict"; 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