From 18927bd74572ed06b5a1b2382eae5bcbae8b21e4 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Mon, 11 Oct 2021 21:25:29 +0200 Subject: [PATCH] Improved utils by removing old imports and fixing comments --- src/utils.ts | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index d612034..16e216f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,13 +1,8 @@ -import { EOL } from "os"; -import type * as Schemas from "./schemas"; -import { sep } from "path"; - /** * Checks if an rgb value is compliant with CSS-like syntax * - * @function isValidRGB - * @params {String} value - string to analyze - * @returns {Boolean} True if valid rgb, false otherwise + * @params value - string to analyze + * @returns true if valid rgb, false otherwise */ export function isValidRGB(value?: string): boolean { @@ -26,6 +21,12 @@ export function isValidRGB(value?: string): boolean { return rgb.slice(1, 4).every((v) => Math.abs(Number(v)) <= 255); } +/** + * Acts as a wrapper for converting date to W3C string + * @param date + * @returns + */ + export function processDate(date: Date): string | null { if (!(date instanceof Date)) { throw "Invalid date"; @@ -50,10 +51,6 @@ export function processDate(date: Date): string | null { */ function dateToW3CString(date: Date) { - if (!(date instanceof Date)) { - return ""; - } - // if it is NaN, it is "Invalid Date" if (isNaN(Number(date))) { return undefined; @@ -90,11 +87,10 @@ function padMeTwo(original: string | number) { } /** - * Apply a filter to arg0 to remove hidden files names (starting with dot) + * Removes hidden files from a list (those starting with dot) * - * @function removeHidden - * @params {String[]} from - list of file names - * @return {String[]} + * @params from - list of file names + * @return */ export function removeHidden(from: Array): Array {