| 2 | import { GeolocationFilter } from 'src/shelter/types/search.types'; |
| 3 | |
| 4 | class ServerResponse<T> { |
| 5 | readonly message: string; |
| 6 | private readonly statusCode: number; |
| 7 | private readonly respData?: T; |
| 8 | |
| 9 | constructor(statusCode: number, message: string, data?: T) { |
| 10 | this.statusCode = statusCode; |
| 11 | this.message = message; |
| 12 | this.respData = data; |
| 13 | } |
| 14 | |
| 15 | public get data(): { statusCode: number; message: string; data?: T } { |
| 16 | const resp = { |
| 17 | statusCode: this.statusCode, |
| 18 | message: this.message, |
| 19 | data: this.respData, |
| 20 | }; |
| 21 | if (!resp?.data) delete resp.data; |
| 22 | return resp; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | function removeNotNumbers(input: string): string { |
| 27 | return input.replace(/[^0-9]/g, ''); |
nothing calls this directly
no outgoing calls
no test coverage detected