How to use the change-case.isUpperCase function in change-case

To help you get started, we’ve selected a few change-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 joshwcomeau / react-collection-helpers / tools / add-component.js View on Github external
function run(ComponentName) {
  if (!ComponentName) {
    throw new Error(`
      Please supply a component name!
      'npm run add-component -- YourComponentName'
    `);
  } else if (!changeCase.isUpperCase(ComponentName[0])) {
    throw new Error(`
      Custom React components need to be in PascalCase.
      You provided ${ComponentName}.

      Please capitalize the first letter:
      "${changeCase.upperCaseFirst(ComponentName)}"
    `);
  }

  const componentDirectory = path.join(
    __dirname,
    '../src/components',
    ComponentName
  );
  createDirectory(componentDirectory);
github joshwcomeau / return-null / tools / add-component / index.js View on Github external
function run(ComponentName) {
  if (!ComponentName) {
    throw new Error(`
      Please supply a component name!
      'npm run add-component -- YourComponentName'
    `);
  } else if (!changeCase.isUpperCase(ComponentName[0])) {
    throw new Error(`
      Custom React components need to be in PascalCase.
      You provided ${ComponentName}.

      Please capitalize the first letter:
      "${changeCase.upperCaseFirst(ComponentName)}"
    `);
  }

  const componentDirectory = path.join(
    __dirname,
    '../../presentation/components',
    ComponentName
  );
  createDirectory(componentDirectory);
github joshwcomeau / fakebook / tools / add-component / index.js View on Github external
function run(ComponentName) {
  if (!ComponentName) {
    throw new Error(`
      Please supply a component name!
      'npm run add-component -- YourComponentName'
    `);
  } else if (!changeCase.isUpperCase(ComponentName[0])) {
    throw new Error(`
      Custom React components need to be in PascalCase.
      You provided ${ComponentName}.

      Please capitalize the first letter:
      "${changeCase.upperCaseFirst(ComponentName)}"
    `);
  }

  const componentDirectory = path.join(
    __dirname,
    '../../src/components',
    ComponentName
  );
  createDirectory(componentDirectory);