Dropped custom GUID validation function in favour of standard uuid library.
All checks were successful
build / build (push) Successful in 10s
All checks were successful
build / build (push) Successful in 10s
This commit is contained in:
@@ -9,3 +9,4 @@ export {
|
||||
readCsvFromStdin,
|
||||
renderOutput,
|
||||
} from "./cli/utils.ts";
|
||||
export { getConfig } from "./config/index.ts";
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { validate as validateUuid } from "uuid";
|
||||
|
||||
type Scalar = string | number | boolean | null | undefined;
|
||||
type ScalarRow = Record<string, Scalar>;
|
||||
|
||||
@@ -20,7 +22,7 @@ function formatCell(value: unknown): string {
|
||||
}
|
||||
|
||||
const inlineCodePredicates = [
|
||||
(value: Scalar): boolean => isGuid(value),
|
||||
(value: Scalar): boolean => typeof value === "string" && validateUuid(value),
|
||||
(value: Scalar): boolean =>
|
||||
typeof value === "string"
|
||||
&& /^(?:\d{1,3}\.){3}\d{1,3}(?:\/(?:\d{1,2}|(?:\d{1,3}\.){3}\d{1,3}))?$/.test(value),
|
||||
@@ -38,11 +40,6 @@ function renderCell(raw: Scalar, shouldQuote: boolean): string {
|
||||
return text;
|
||||
}
|
||||
|
||||
function isGuid(value: unknown): value is string {
|
||||
return typeof value === "string"
|
||||
&& /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
||||
}
|
||||
|
||||
function toAutoHeaderLabel(key: string): string {
|
||||
const withSpaces = String(key)
|
||||
.replace(/[_-]+/g, " ")
|
||||
|
||||
Reference in New Issue
Block a user