@freeword/meta
Version:
Meta package for Freeword: exports all core types, constants, and utilities from the src/ directory.
40 lines • 1.98 kB
JavaScript
import { num, obj, str, oneof, arr, safeint, } from "./BootChecks.js";
import { LABEL, MEDSTR, IMAGE_PATH, HEXCOLOR, MONEYISH, UBUX } from "../Consts.js";
import { namestr, handleish, asciish } from "../consts/index.js";
import { keyish, medstr, quantity, lat, lng, trimmed, lower, } from "../consts/PrimshapeChecks.js";
import { currency } from "../consts/EnumChecks.js";
import { urlstr } from "./UrlChecks.js";
// == [Price Related Types] ==
export const ubux = num.int().min(UBUX.min).max(UBUX.max);
export const price = obj({ ubux, currency });
export const moneyish = trimmed.regex(MONEYISH.re);
export const tax_rate = trimmed.regex(LABEL.re, LABEL.msg).max(LABEL.max);
export const masked_num = trimmed.max(MEDSTR.max).regex(/^[0-9#\-]*$/);
export const pts_stub = obj({ num: quantity });
export const place_stub = obj({ lat, lng });
// --
// == [Image and Color Types] ==
export const hexcolor = lower.regex(HEXCOLOR.re);
export const imageStub = obj({ url0: urlstr.optional() }).passthrough();
export const brandcode = keyish;
export const brandname = namestr;
export const family = handleish;
export const fmt = medstr;
export const mashword = medstr;
export const pricestr = str.max(20).regex(/^([\$\-\d\.\s]*)$/);
export const image_path = trimmed.regex(IMAGE_PATH.re);
export const imageOrUrl = imageStub.or(urlstr);
export const distance = safeint.describe('Distance');
// --
// == [Other Semantic Strings] ==
export const namespace = handleish;
export const maskedccnum = asciish;
export const orig = medstr;
export const plainwords = arr(medstr);
export const plan = asciish;
export const HTTPMethodVals = ['get', 'delete', 'head', 'options', 'post', 'put', 'patch', 'purge', 'link', 'unlink'];
export const HTTPMETHODVals = ['GET', 'DELETE', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'PURGE', 'LINK', 'UNLINK'];
export const httpMethod = oneof(HTTPMethodVals);
export const httpMETHOD = oneof(HTTPMETHODVals);
// --
//# sourceMappingURL=WorldlyChecks.js.map