perf(bundle): drop fp-ts

This commit is contained in:
rusconn
2024-09-19 01:45:04 +09:00
parent f12adfa296
commit ddaed4a08b
4 changed files with 11 additions and 16 deletions

View File

@@ -1,7 +1,6 @@
"use client";
import { useCallback, useState } from "react";
import { range } from "fp-ts/NonEmptyArray";
import { toolGroups } from "@/config/tools";
import { uuid } from "@/lib/uuid";
@@ -58,7 +57,7 @@ export default function Page() {
}, []);
const onGenerateClick = () => {
const newUuids = range(1, generates).map(_ => uuid(uuidVersion, hyphens, uppercase));
const newUuids = Array.from({ length: generates }, () => uuid(uuidVersion, hyphens, uppercase));
setUuids([...uuids, ...newUuids]);
};

View File

@@ -1,5 +1,3 @@
import { chunksOf, intersperse } from "fp-ts/Array";
const match = (regex: RegExp) => (x: string) => regex.test(x);
export const isDecimal = match(/^[0-9]*$/);
@@ -8,10 +6,16 @@ export const isOctal = match(/^[0-7]*$/);
export const isBinary = match(/^[0-1]*$/);
const formatNumber = (digits: number, sep: string) => (s: string) => {
const a = [...s].reverse();
const b = chunksOf(digits)(a);
const c = intersperse([sep])(b);
return c.flat().reverse().join("");
const head = ((s.length - 1) % digits) + 1;
const buf = [];
buf.push(s.substring(0, head));
for (let i = head; i < s.length; i += digits) {
buf.push(sep, s.substring(i, i + digits));
}
return buf.join("");
};
export const formatDecimal = formatNumber(3, ",");

View File

@@ -36,7 +36,6 @@
"clsx": "^1.2.1",
"cmdk": "^0.2.0",
"create-hash": "^1.2.0",
"fp-ts": "^2.16.0",
"fuse.js": "^6.6.2",
"html-escaper": "^3.0.3",
"js-yaml": "^4.1.0",

7
pnpm-lock.yaml generated
View File

@@ -34,9 +34,6 @@ dependencies:
create-hash:
specifier: ^1.2.0
version: 1.2.0
fp-ts:
specifier: ^2.16.0
version: 2.16.0
fuse.js:
specifier: ^6.6.2
version: 6.6.2
@@ -3083,10 +3080,6 @@ packages:
is-callable: 1.2.7
dev: true
/fp-ts@2.16.0:
resolution: {integrity: sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==}
dev: false
/fraction.js@4.2.0:
resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==}
dev: true