Check for empty string on matching empty target string

This commit is contained in:
2023-05-23 22:56:39 -05:00
parent 3b20643892
commit d2bcbfd759

View File

@@ -135,7 +135,7 @@ const useLookup = (warningHandler?: WarningHandler) => {
}
async function submitInternal(): Promise<ParsedGeneric | undefined> {
if (target == null)
if (target == null || target.length == 0)
throw new Error("A target must be given in order to execute a lookup.");
const targetType = getType(target);
@@ -173,9 +173,9 @@ const useLookup = (warningHandler?: WarningHandler) => {
}
}
async function submit(
props: SubmitProps
): Promise<ParsedGeneric | undefined> {
async function submit({
target,
}: SubmitProps): Promise<ParsedGeneric | undefined> {
try {
const response = await submitInternal();
if (response == undefined)