mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-17 04:59:23 +00:00
perf(bundle): drop fp-ts
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { range } from "fp-ts/NonEmptyArray";
|
|
||||||
|
|
||||||
import { toolGroups } from "@/config/tools";
|
import { toolGroups } from "@/config/tools";
|
||||||
import { uuid } from "@/lib/uuid";
|
import { uuid } from "@/lib/uuid";
|
||||||
@@ -58,7 +57,7 @@ export default function Page() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onGenerateClick = () => {
|
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]);
|
setUuids([...uuids, ...newUuids]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
16
lib/base.ts
16
lib/base.ts
@@ -1,5 +1,3 @@
|
|||||||
import { chunksOf, intersperse } from "fp-ts/Array";
|
|
||||||
|
|
||||||
const match = (regex: RegExp) => (x: string) => regex.test(x);
|
const match = (regex: RegExp) => (x: string) => regex.test(x);
|
||||||
|
|
||||||
export const isDecimal = match(/^[0-9]*$/);
|
export const isDecimal = match(/^[0-9]*$/);
|
||||||
@@ -8,10 +6,16 @@ export const isOctal = match(/^[0-7]*$/);
|
|||||||
export const isBinary = match(/^[0-1]*$/);
|
export const isBinary = match(/^[0-1]*$/);
|
||||||
|
|
||||||
const formatNumber = (digits: number, sep: string) => (s: string) => {
|
const formatNumber = (digits: number, sep: string) => (s: string) => {
|
||||||
const a = [...s].reverse();
|
const head = ((s.length - 1) % digits) + 1;
|
||||||
const b = chunksOf(digits)(a);
|
const buf = [];
|
||||||
const c = intersperse([sep])(b);
|
|
||||||
return c.flat().reverse().join("");
|
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, ",");
|
export const formatDecimal = formatNumber(3, ",");
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"cmdk": "^0.2.0",
|
"cmdk": "^0.2.0",
|
||||||
"create-hash": "^1.2.0",
|
"create-hash": "^1.2.0",
|
||||||
"fp-ts": "^2.16.0",
|
|
||||||
"fuse.js": "^6.6.2",
|
"fuse.js": "^6.6.2",
|
||||||
"html-escaper": "^3.0.3",
|
"html-escaper": "^3.0.3",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
|
|||||||
7
pnpm-lock.yaml
generated
7
pnpm-lock.yaml
generated
@@ -34,9 +34,6 @@ dependencies:
|
|||||||
create-hash:
|
create-hash:
|
||||||
specifier: ^1.2.0
|
specifier: ^1.2.0
|
||||||
version: 1.2.0
|
version: 1.2.0
|
||||||
fp-ts:
|
|
||||||
specifier: ^2.16.0
|
|
||||||
version: 2.16.0
|
|
||||||
fuse.js:
|
fuse.js:
|
||||||
specifier: ^6.6.2
|
specifier: ^6.6.2
|
||||||
version: 6.6.2
|
version: 6.6.2
|
||||||
@@ -3083,10 +3080,6 @@ packages:
|
|||||||
is-callable: 1.2.7
|
is-callable: 1.2.7
|
||||||
dev: true
|
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:
|
/fraction.js@4.2.0:
|
||||||
resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==}
|
resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|||||||
Reference in New Issue
Block a user