UNPKG

@graphql-codegen/c-sharp-common

Version:
20 lines (19 loc) 922 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMemberNamingFunction = getMemberNamingFunction; const change_case_all_1 = require("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 */ function getMemberNamingFunction(rawConfig) { switch (rawConfig.memberNameConvention) { case 'camelCase': return (input) => (0, change_case_all_1.camelCase)(typeof input === 'string' ? input : input.value); case 'pascalCase': return (input) => (0, change_case_all_1.pascalCase)(typeof input === 'string' ? input : input.value); default: return (input) => (0, change_case_all_1.camelCase)(typeof input === 'string' ? input : input.value); } }