Skip to content

Commit

Permalink
feat: use object freeze for connection args
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Aug 1, 2021
1 parent 1723186 commit 2f49665
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,35 @@ import type {
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
* whose return type is a connection type with forward pagination.
*/
export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap = {
after: {
type: GraphQLString,
description:
'Returns the items in the list that come after the specified cursor.',
},
first: {
type: GraphQLInt,
description: 'Returns the first n items from the list.',
},
};
export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap =
Object.freeze({
after: {
type: GraphQLString,
description:
'Returns the items in the list that come after the specified cursor.',
},
first: {
type: GraphQLInt,
description: 'Returns the first n items from the list.',
},
});

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
* whose return type is a connection type with backward pagination.
*/
export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap = {
before: {
type: GraphQLString,
description:
'Returns the items in the list that come before the specified cursor.',
},
last: {
type: GraphQLInt,
description: 'Returns the last n items from the list.',
},
};
export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap =
Object.freeze({
before: {
type: GraphQLString,
description:
'Returns the items in the list that come before the specified cursor.',
},
last: {
type: GraphQLInt,
description: 'Returns the last n items from the list.',
},
});

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
Expand Down

0 comments on commit 2f49665

Please sign in to comment.