function getExistence(expression, scope) {
	const isNegated =
		expression.type === "UnaryExpression" && expression.operator === "!";
	const base = isNegated ? expression.argument : expression;

	switch (true) {
		case isReference(base):
			return { reference: base, operator: isNegated ? "||" : "&&" };
		case base.type === "UnaryExpression" &&
			base.operator === "!" &&
			isReference(base.argument):
			return { reference: base.argument, operator: "&&" };
		case isBooleanCast(base, scope) && isReference(base.arguments[0]):
			return {
				reference: base.arguments[0],
				operator: isNegated ? "||" : "&&",
			};
		case isImplicitNullishComparison(expression, scope):
			return {
				reference: isReference(expression.left)
					? expression.left
					: expression.right,
				operator: "??",
			};
		case isExplicitNullishComparison(expression, scope):
			return {
				reference: isReference(expression.left.left)
					? expression.left.left
					: expression.left.right,
				operator: "??",
			};
		default:
			return null;
	}
}
Returns true for:
truthiness checks:  value, Boolean(value), !!value
falsiness checks:   !value, !Boolean(value)
nullish checks:     value == null, value === undefined || value === null
@param {ASTNode} expression Test condition
@param {import('eslint-scope').Scope} scope Scope of the expression
@returns {?{ reference: ASTNode, operator: '??'|'||'|'&&'}} Null if not a known existence