Skip to content

Commit 39ecad2

Browse files
authored
feat: use object freeze for connection args (#353)
1 parent b9def62 commit 39ecad2

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/connection/connection.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,35 @@ import type {
2020
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
2121
* whose return type is a connection type with forward pagination.
2222
*/
23-
export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap = {
24-
after: {
25-
type: GraphQLString,
26-
description:
27-
'Returns the items in the list that come after the specified cursor.',
28-
},
29-
first: {
30-
type: GraphQLInt,
31-
description: 'Returns the first n items from the list.',
32-
},
33-
};
23+
export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap =
24+
Object.freeze({
25+
after: {
26+
type: GraphQLString,
27+
description:
28+
'Returns the items in the list that come after the specified cursor.',
29+
},
30+
first: {
31+
type: GraphQLInt,
32+
description: 'Returns the first n items from the list.',
33+
},
34+
});
3435

3536
/**
3637
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
3738
* whose return type is a connection type with backward pagination.
3839
*/
39-
export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap = {
40-
before: {
41-
type: GraphQLString,
42-
description:
43-
'Returns the items in the list that come before the specified cursor.',
44-
},
45-
last: {
46-
type: GraphQLInt,
47-
description: 'Returns the last n items from the list.',
48-
},
49-
};
40+
export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap =
41+
Object.freeze({
42+
before: {
43+
type: GraphQLString,
44+
description:
45+
'Returns the items in the list that come before the specified cursor.',
46+
},
47+
last: {
48+
type: GraphQLInt,
49+
description: 'Returns the last n items from the list.',
50+
},
51+
});
5052

5153
/**
5254
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field

0 commit comments

Comments
 (0)