UNPKG

@estarlincito/utils

Version:

A collection of utility functions designed to simplify and speed up development tasks in JavaScript and TypeScript projects.

2 lines (1 loc) 390 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),s=require("./handle-error.cjs"),a=e=>{const n=t.z.string().refine(r=>/^-?\d*\.?\d+$/.test(r),{message:"Format invalid number"}).transform(r=>parseFloat(r)).refine(r=>!isNaN(r),{message:"Invalid number"});try{return n.parse(e)}catch{throw s.handleError("Invalid number")}};exports.num=a;