(value: any)
| 36 | } |
| 37 | |
| 38 | function toPositiveInt(value: any): number { |
| 39 | if (value == null) { |
| 40 | return 0; |
| 41 | } |
| 42 | if (typeof value === 'number') { |
| 43 | return value > 0 ? Math.floor(value) : 0; |
| 44 | } |
| 45 | if (typeof value === 'string') { |
| 46 | const parsed = parseInt(value, 10); |
| 47 | return isNaN(parsed) || parsed <= 0 ? 0 : parsed; |
| 48 | } |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | function normalizeImageAssetOptions(options: ImageAssetOptions): ImageAssetOptions { |
| 53 | const normalized = options ? { ...options } : ({} as ImageAssetOptions); |
no outgoing calls
no test coverage detected