export function getBpUpperLimit()

in src/data/breakpoints.ts [22:38]


export function getBpUpperLimit(bpName: string) {
	if (!Number.isNaN(parseInt(bpName))) {
		return null;
	}

	const bpKeys = Object.keys(BREAKPOINTS);
	const nextHighestBpIndex = bpKeys.indexOf(bpName) + 1;

	// Check edge-case for when target breakpoint is the last in the array, in which
	// case Infinity is an acceptable upper-bound, since there is no threshold
	const nextHighestBpWidth =
		nextHighestBpIndex !== bpKeys.length - 1
			? BREAKPOINTS[bpKeys[nextHighestBpIndex]]
			: Infinity;

	return nextHighestBpWidth;
}