Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 466 Bytes
652f343 7bea24d 652f343 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import { getValidNumber } from "./getValidNumber.mts"
export const getValidResolution = (something: any) => {
const strValue = `${something || ''}`
const chunks = strValue.split('x')
console.log("chunks:", chunks)
if (chunks.length !== 2) {
return `1280x720`
}
const [widthStr, heightStr] = chunks
const width = getValidNumber(widthStr, 256, 1280, 1280)
const height = getValidNumber(widthStr, 256, 720, 720)
return `${width}x${height}`
} |