How to use the camel-case.camelCase function in camel-case

To help you get started, we’ve selected a few camel-case examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dotansimha / graphql-code-generator / packages / plugins / java / apollo-android / src / operation-visitor.ts View on Github external
childFragmentSpread.map(spread => ({
          name: camelCase(spread.name),
          type: spread.name,
          annotations: ['Nonnull'],
        })),
        [],
github dotansimha / graphql-code-generator / packages / plugins / typescript / react-apollo / src / visitor.ts View on Github external
* you can use to render your UI.`;

    const queryExample = `
 * const { data, loading, error } = use${operationName}({
 *   variables: {${variableString}
 *   },
 * });`;

    const mutationDescription = `
 * To run a mutation, you first call \`use${operationName}\` within a React component and pass it any options that fit your needs.
 * When your component renders, \`use${operationName}\` returns a tuple that includes:
 * - A mutate function that you can call at any time to execute the mutation
 * - An object with fields that represent the current status of the mutation's execution`;

    const mutationExample = `
 * const [${camelCase(operationName)}, { data, loading, error }] = use${operationName}({
 *   variables: {${variableString}
 *   },
 * });`;

    return `
/**
 * __use${operationName}__
 *${operationType === 'Mutation' ? mutationDescription : queryDescription}
 *
 * @param baseOptions options that will be passed into the ${operationType.toLowerCase()}, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#${operationType === 'Mutation' ? 'options-2' : 'options'};
 *
 * @example${operationType === 'Mutation' ? mutationExample : queryExample}
 */`;
  }
github dotansimha / graphql-code-generator / packages / plugins / typescript / apollo-angular / src / visitor.ts View on Github external
    const injectString = (service: string) => `private ${camelCase(service)}: ${service}`;
    const injections = this._operationsToInclude
github adonisjs / ace / src / Generator / StringTransformer.ts View on Github external
public changeCase (pattern?: 'pascalcase' | 'camelcase' | 'snakecase'): this {
    switch (pattern) {
      case 'camelcase':
        this.input = camelCase(this.input)
        return this
      case 'pascalcase':
        this.input = pascalCase(this.input)
        return this
      case 'snakecase':
        this.input = snakeCase(this.input)
        return this
      default:
        return this
    }
  }
github dotansimha / graphql-code-generator / packages / plugins / java / apollo-android / src / operation-visitor.ts View on Github external
this._imports.add(Imports.Utils);

            return `this.${varName} = Utils.checkNotNull(${varName}, "${varName} == null");`;
          })
          .join('\n'),
        childFragmentSpread.map(spread => ({
          name: camelCase(spread.name),
          type: spread.name,
          annotations: ['Nonnull'],
        })),
        [],
        'public'
      );

      for (const spread of childFragmentSpread) {
        const fragmentVarName = camelCase(spread.name);
        fragmentsClass.addClassMember(fragmentVarName, spread.name, null, ['Nonnull'], 'private', { final: true });
        fragmentsClass.addClassMethod(fragmentVarName, spread.name, `return this.${fragmentVarName};`, [], ['Nonnull'], 'public', {}, []);
        fragmentMapperClass.addClassMember(`${fragmentVarName}FieldMapper`, `${spread.name}.Mapper`, `new ${spread.name}.Mapper()`, [], 'private', { final: true });
      }

      fragmentMapperClass.addClassMethod(
        'map',
        fragmentsClassName,
        `
${childFragmentSpread
  .map(spread => {
    const fragmentVarName = camelCase(spread.name);

    return `${spread.name} ${fragmentVarName} = null;
if (${spread.name}.POSSIBLE_TYPES.contains(conditionalType)) {
  ${fragmentVarName} = ${fragmentVarName}FieldMapper.map(reader);
github dotansimha / graphql-code-generator / packages / plugins / typescript / react-apollo / src / visitor.ts View on Github external
private _buildOperationHoc(node: OperationDefinitionNode, documentVariableName: string, operationResultType: string, operationVariablesTypes: string): string {
    this.imports.add(this.getApolloReactCommonImport());
    this.imports.add(this.getApolloReactHocImport());
    const operationName: string = this.convertName(node.name.value, { useTypesPrefix: false });
    const propsTypeName: string = this.convertName(node.name.value, { suffix: 'Props' });

    const propsVar = `export type ${propsTypeName} = ${this._buildHocProps(node.name.value, node.operation)} | TChildProps;`;

    const hocString = `export function with${operationName}(operationOptions?: ApolloReactHoc.OperationOption<
  TProps,
  ${operationResultType},
  ${operationVariablesTypes},
  ${propsTypeName}>) {
    return ApolloReactHoc.with${pascalCase(node.operation)}>(${this.getDocumentNodeVariable(node, documentVariableName)}, {
      alias: '${camelCase(operationName)}',
      ...operationOptions
    });
};`;

    return [propsVar, hocString].filter(a => a).join('\n');
  }
github hexojs / hexo-util / lib / camel_case_keys.js View on Github external
function toCamelCase(str) {
  let prefixLength = -1;

  while (str[++prefixLength] === '_');

  if (!prefixLength) {
    return camelCase(str);
  }
  return str.substring(0, prefixLength) + camelCase(str.substring(prefixLength));
}
github dotansimha / graphql-code-generator / packages / plugins / java / apollo-android / src / operation-visitor.ts View on Github external
.map(spread => {
      const varName = camelCase(spread.name);

      return indentMultiline(`h *= 1000003;\nh ^= ${varName}.hashCode();`, 1);
    })
    .join('\n')}
github dotansimha / graphql-code-generator / packages / plugins / typescript / apollo-angular / src / visitor.ts View on Github external
.map(o => {
        const optionalVariables = !o.node.variableDefinitions || o.node.variableDefinitions.length === 0 || o.node.variableDefinitions.every(v => v.type.kind !== Kind.NON_NULL_TYPE || !!v.defaultValue);

        const options = o.operationType === 'Mutation' ? `${o.operationType}OptionsAlone<${o.operationResultType}, ${o.operationVariablesTypes}>` : `${o.operationType}OptionsAlone<${o.operationVariablesTypes}>`;

        const method = `
${camelCase(o.node.name.value)}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, options?: ${options}) {
  return this.${camelCase(o.serviceName)}.${actionType(o.operationType)}(variables, options)
}`;

        let watchMethod;

        if (o.operationType === 'Query') {
          watchMethod = `

${camelCase(o.node.name.value)}Watch(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, options?: WatchQueryOptionsAlone<${o.operationVariablesTypes}>) {
  return this.${camelCase(o.serviceName)}.watch(variables, options)
}`;
        }
        return [method, watchMethod].join('');
      })
      .map(s => indentMultiline(s, 2));

camel-case

Transform into a string with the separator denoted by the next word capitalized

MIT
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis

Popular camel-case functions