17 lines
503 B
TypeScript
17 lines
503 B
TypeScript
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
|
|
/** Bill tokens are UUID v4 from the tablet. */
|
|
export function isUuid(value: string): boolean {
|
|
return UUID_RE.test(value);
|
|
}
|
|
|
|
/**
|
|
* Row ids are UUID v4, except shop_settings which the tablet seeds as "default".
|
|
* CHAR(36) and a tight charset. Values are still bound as parameters.
|
|
*/
|
|
const ROW_ID_RE = /^[0-9a-zA-Z_-]{1,36}$/;
|
|
|
|
export function isRowId(value: string): boolean {
|
|
return ROW_ID_RE.test(value);
|
|
}
|