src/vs/base/common/objects.ts/getOrDefault
export function getOrDefault<T, R>(obj: T, fn: (obj: T) => R | undefined, defaultValue: R): R {
	const result = fn(obj);
	return typeof result === 'undefined' ? defaultValue : result;
}