How to use the pascal-case.pascalCase function in pascal-case

To help you get started, we’ve selected a few pascal-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 octokit / webhooks.js / scripts / generate-types.js View on Github external
webhooks.forEach(({ name, actions, examples }) => {
  if (!examples) {
    return;
  }

  const typeName = `WebhookPayload${pascalCase(name)}`;
  tw.add(examples, {
    rootTypeName: typeName,
    namedKeyPaths: {
      [`${typeName}.repository`]: "PayloadRepository",
      // This prevents a naming colision between the payload of a `installation_repositories` event
      // and the `repositories` attribute of a `installation` event
      "WebhookPayloadInstallation.repositories":
        "WebhookPayloadInstallation_Repositories"
    }
  });

  const events = [
    `'${name}'`,
    ...actions.map(action => `'${name}.${action}'`)
  ].join(" | ");
  signatures.push(`
github dotansimha / graphql-code-generator / packages / utils / plugins-helpers / src / to-pascal-case.ts View on Github external
    return str.replace(/^(_*)(.*)/, (_match, underscorePrefix, typeName) => `${underscorePrefix}${pascalCase(typeName || '')}`);
  }
github dotansimha / graphql-code-generator / packages / plugins / typescript / react-apollo / src / visitor.ts View on Github external
const hookFns = [
      `export function use${operationName}(baseOptions?: ApolloReactHooks.${operationType}HookOptions<${operationResultType}, ${operationVariablesTypes}>) {
        return ApolloReactHooks.use${operationType}<${operationResultType}, ${operationVariablesTypes}>(${this.getDocumentNodeVariable(node, documentVariableName)}, baseOptions);
      }`,
    ];

    if (this.config.addDocBlocks) {
      hookFns.unshift(this._buildHooksJSDoc(node, operationName, operationType));
    }

    const hookResults = [`export type ${operationName}HookResult = ReturnType;`];

    if (operationType === 'Query') {
      const lazyOperationName: string = this.convertName(node.name.value, {
        suffix: pascalCase('LazyQuery'),
        useTypesPrefix: false,
      });
      hookFns.push(
        `export function use${lazyOperationName}(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<${operationResultType}, ${operationVariablesTypes}>) {
          return ApolloReactHooks.useLazyQuery<${operationResultType}, ${operationVariablesTypes}>(${this.getDocumentNodeVariable(node, documentVariableName)}, baseOptions);
        }`
      );
      hookResults.push(`export type ${lazyOperationName}HookResult = ReturnType;`);
    }

    return [...hookFns, ...hookResults].join('\n');
  }
github doczjs / docz / core / docz / src / components / Props.tsx View on Github external
const componentMatcher = (componentName: string, item: any) => {
    const matchingPatterns = [
      filename,
      `/${componentName}.`,
      `/${kebabCase(componentName)}.`,
      `/${pascalCase(componentName)}.`,
    ]
    return !!matchingPatterns.find(pattern => item.key.includes(pattern))
  }
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 KnisterPeter / react-to-typescript-definitions / src / typings.ts View on Github external
interf.members.forEach((member) => {
    if (member.kind === 'property' && isExtractableType(member.type)) {
      const name = `${componentName}${pascalCase(member.name)}`;
      const extractedMember = createModuleMember(name, member.type);
      if (extractedMember) {
        extractedMember.flags = dom.DeclarationFlags.Export;
        m.members.push(extractedMember);
        member.type = createTypeReference(name, member.type);
      }
    }
  });
}
github vaeum / react-material-icon-svg / gulpfile.babel.js View on Github external
$.rename(file => {
        file.basename = `${pascalCase(file.basename)}`;
        file.extname = '.js';
      })
    )
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 / typescript / urql / src / visitor.ts View on Github external
private _buildHooks(node: OperationDefinitionNode, operationType: string, documentVariableName: string, operationResultType: string, operationVariablesTypes: string): string {
    const operationName: string = this.convertName(node.name.value, { suffix: pascalCase(operationType), useTypesPrefix: false });

    if (operationType === 'Mutation') {
      return `
export function use${operationName}() {
  return Urql.use${operationType}<${operationResultType}, ${operationVariablesTypes}>(${documentVariableName});
};`;
    }

    if (operationType === 'Subscription') {
      return `
export function use${operationName}(options: Omit, 'query'> = {}, handler?: Urql.SubscriptionHandler<${operationName}, TData>) {
  return Urql.use${operationType}<${operationResultType}, TData, ${operationVariablesTypes}>({ query: ${documentVariableName}, ...options }, handler);
};`;
    }

    return `
github dotansimha / graphql-code-generator / packages / utils / plugins-helpers / src / to-pascal-case.ts View on Github external
export function toPascalCase(str: string) {
  if (str.charAt(0) === '_') {
    return str.replace(/^(_*)(.*)/, (_match, underscorePrefix, typeName) => `${underscorePrefix}${pascalCase(typeName || '')}`);
  }

  return pascalCase(str || '');
}

pascal-case

Transform into a string of capitalized words without separators

MIT
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis