UNPKG

@graphql-codegen/c-sharp-common

Version:
17 lines (16 loc) 727 B
import { camelCase, pascalCase } from 'change-case-all'; /** * @description Get the member naming function based on the provided configuration. * @param rawConfig Config to decide which concrete naming function to return. Fallback to camelCase if not provided. * @returns */ export function getMemberNamingFunction(rawConfig) { switch (rawConfig.memberNameConvention) { case 'camelCase': return (input) => camelCase(typeof input === 'string' ? input : input.value); case 'pascalCase': return (input) => pascalCase(typeof input === 'string' ? input : input.value); default: return (input) => camelCase(typeof input === 'string' ? input : input.value); } }