10 lines
369 B
JavaScript
10 lines
369 B
JavaScript
const isForwardSearch = (givenPageInfo) => {
|
|
return givenPageInfo.hasOwnProperty("hasNextPage");
|
|
};
|
|
const getCursorFrom = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.endCursor : pageInfo.startCursor;
|
|
const hasAnotherPage = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.hasNextPage : pageInfo.hasPreviousPage;
|
|
export {
|
|
getCursorFrom,
|
|
hasAnotherPage
|
|
};
|