Skip to content

Commit

Permalink
Add helper for filtering search results to full objects (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhart92 authored Jun 27, 2023
1 parent 1ae1d3f commit 550c51c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ export function isFullDatabase(
return "title" in response
}

/**
* @returns `true` if `response` is a full `DatabaseObjectResponse` or a full
* `PageObjectResponse`.
*/
export function isFullPageOrDatabase(
response:
| DatabaseObjectResponse
| PartialDatabaseObjectResponse
| PageObjectResponse
| PartialPageObjectResponse
): response is DatabaseObjectResponse | PageObjectResponse {
if (response.object === "database") {
return isFullDatabase(response)
} else {
return isFullPage(response)
}
}

/**
* @returns `true` if `response` is a full `UserObjectResponse`.
*/
Expand Down

0 comments on commit 550c51c

Please sign in to comment.