web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit df042d428b02f8f5caf2c7786f8c6ccd2e59efd4
parent e16e1f187b22a338d1ac52034b52a2de300c6ab7
Author: triesap <137732411+triesap@users.noreply.github.com>
Date:   Sun,  1 Sep 2024 12:40:41 +0000

utils: add trade utils

Diffstat:
Mutils/src/index.ts | 1+
Autils/src/trade.ts | 4++++
Mutils/src/types.ts | 1-
Mutils/src/utils.ts | 1+
4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/utils/src/index.ts b/utils/src/index.ts @@ -2,5 +2,6 @@ import "./global.d.ts"; export * from "./geolocation" export * from "./jshashes" +export * from "./trade" export * from "./types" export * from "./utils" diff --git a/utils/src/trade.ts b/utils/src/trade.ts @@ -0,0 +1,3 @@ +export type TradeKey = `coffee` | `cacao` | `maca`; + +export const trade_keys: TradeKey[] = [`coffee`, `cacao`, `maca`] as const; +\ No newline at end of file diff --git a/utils/src/types.ts b/utils/src/types.ts @@ -1,4 +1,3 @@ - export type ErrorResponse = { error: string; }; diff --git a/utils/src/utils.ts b/utils/src/utils.ts @@ -5,6 +5,7 @@ export const regex: Record<string, RegExp> = { word_only: /^[a-zA-Z]+$/, alpha: /[a-zA-Z ]$/, num: /^[0-9.]+$/, + alphanum: /[a-zA-Z0-9., ]$/, }; export function uuidv4() {