mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-16 20:49:23 +00:00
refactor: drop io-ts
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import { useCallback, useState } from "react";
|
||||
import { range } from "fp-ts/NonEmptyArray";
|
||||
import * as t from "io-ts";
|
||||
|
||||
import { toolGroups } from "@/config/tools";
|
||||
import { uuid } from "@/lib/uuid";
|
||||
@@ -26,8 +25,11 @@ const versions = {
|
||||
v4: "4",
|
||||
} as const;
|
||||
|
||||
const uuidVersions = t.keyof({ [versions.v1]: null, [versions.v4]: null });
|
||||
type UuidVersion = t.TypeOf<typeof uuidVersions>;
|
||||
type UuidVersion = (typeof versions)[keyof typeof versions];
|
||||
|
||||
function isUuidVersion(s: string): s is UuidVersion {
|
||||
return Object.values(versions).includes(s as UuidVersion);
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
const [hyphens, setHyphens] = useState(true);
|
||||
@@ -42,7 +44,7 @@ export default function Page() {
|
||||
const clearUuids = useCallback(() => setUuids([]), []);
|
||||
|
||||
const onUuidVersionChange: NonNullable<Select.Props["onValueChange"]> = useCallback(value => {
|
||||
if (uuidVersions.is(value)) {
|
||||
if (isUuidVersion(value)) {
|
||||
setUuidVersion(value);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
"fp-ts": "^2.16.0",
|
||||
"fuse.js": "^6.6.2",
|
||||
"html-escaper": "^3.0.3",
|
||||
"io-ts": "^2.2.20",
|
||||
"js-base64": "^3.7.5",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jwt-decode": "^3.1.2",
|
||||
|
||||
11
pnpm-lock.yaml
generated
11
pnpm-lock.yaml
generated
@@ -43,9 +43,6 @@ dependencies:
|
||||
html-escaper:
|
||||
specifier: ^3.0.3
|
||||
version: 3.0.3
|
||||
io-ts:
|
||||
specifier: ^2.2.20
|
||||
version: 2.2.20(fp-ts@2.16.0)
|
||||
js-base64:
|
||||
specifier: ^3.7.5
|
||||
version: 3.7.5
|
||||
@@ -3427,14 +3424,6 @@ packages:
|
||||
loose-envify: 1.4.0
|
||||
dev: false
|
||||
|
||||
/io-ts@2.2.20(fp-ts@2.16.0):
|
||||
resolution: {integrity: sha512-Rq2BsYmtwS5vVttie4rqrOCIfHCS9TgpRLFpKQCM1wZBBRY9nWVGmEvm2FnDbSE2un1UE39DvFpTR5UL47YDcA==}
|
||||
peerDependencies:
|
||||
fp-ts: ^2.5.0
|
||||
dependencies:
|
||||
fp-ts: 2.16.0
|
||||
dev: false
|
||||
|
||||
/is-arguments@1.1.1:
|
||||
resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
Reference in New Issue
Block a user