MCPcopy Index your code
hub / github.com/omkarcloud/botasaurus / tryIntConversion

Function tryIntConversion

js/botasaurus-server-js/src/validation.ts:7–22  ·  view source on GitHub ↗
(value: any, errorMessage: string)

Source from the content-addressed store, hash-verified

5
6
7export function tryIntConversion(value: any, errorMessage: string): number {
8 if (typeof value === 'string') {
9 try {
10 const parsed = parseInt(value, 10);
11 if (!isNaN(parsed)) {
12 return parsed;
13 }
14 } catch (error) {
15 throw new JsonHTTPResponseWithMessage(errorMessage);
16 }
17
18 }else if (typeof value === 'number' && Number.isInteger(value) ){
19 return value
20 }
21 throw new JsonHTTPResponseWithMessage(errorMessage);
22}
23
24export async function serialize(data: any, withResult: boolean = true){
25 if (isNullish(data)) {

Callers 7

executeGetTasksFunction · 0.90
isValidAllTasksFunction · 0.90
executeIsTaskUpdatedFunction · 0.90
executeGetUiTasksFunction · 0.90
executePatchTaskFunction · 0.90
validateResultsRequestFunction · 0.85
validateAndGetTaskIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected