import { devAssert } from '../jsutils/devAssert' ; import { GraphQLError } from '../error/GraphQLError' ; import { assertName } from '../type/assertName' ; deprecated export function assertValidName ( name ) { const error = isValidNameError ( name ) ; if ( error ) { throw error ; } return name ; } deprecated export function isValidNameError ( name ) { devAssert ( typeof name === 'string' , 'Expected name to be a string.' ) ; if ( name . startsWith ( '__' ) ) { return new GraphQLError ( `Name "${ name }" must not begin with "__", which is reserved by GraphQL introspection.` ) ; } try { assertName ( name ) ; } catch ( error ) { return error ; } }