graphql/type/names
Functions
assertName()
Upholds the spec rules about naming.
Signature:
assertName(name: string): string
Arguments
| Name | Type | Description |
|---|---|---|
| name | string | The GraphQL name to validate. |
Returns
| Type | Description |
|---|---|
string | The validated GraphQL name. |
Example
import { assertName } from 'graphql/type';
const name = assertName('User');
// name: 'User'assertEnumValueName()
Upholds the spec rules about naming enum values.
Signature:
assertEnumValueName(name: string): string
Arguments
| Name | Type | Description |
|---|---|---|
| name | string | The GraphQL name to validate. |
Returns
| Type | Description |
|---|---|
string | The validated GraphQL name. |
Example
import { assertEnumValueName } from 'graphql/type';
const name = assertEnumValueName('ACTIVE');
// name: 'ACTIVE'