susface-api / utils /string.ts
T1ckbase
image
79f7ac0
raw
history blame contribute delete
391 Bytes
export function parseResolution(resolutionString?: string) {
if (!resolutionString) return { width: undefined, height: undefined };
const parts = resolutionString.split('x');
if (parts.length === 2) {
const width = parseInt(parts[0], 10);
const height = parseInt(parts[1], 10);
return { width, height };
} else {
return { width: undefined, height: undefined };
}
}