How to use the messaging-api-common.camelcase function in messaging-api-common

To help you get started, we’ve selected a few messaging-api-common 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 Yoctol / bottender / packages / bottender / src / cli / index.ts View on Github external
const provider = providers[providerName];

  if (argv['--help']) {
    provider.help();
    process.exit(0);
  }

  // the context object to supply to the providers or the commands
  const ctx: CliContext = {
    config: null, // FIXME
    argv,
  };

  try {
    const method = get(provider, camelcase(subcommand));
    if (method) {
      await (provider as any)[camelcase(subcommand)](ctx);
    } else {
      const subcommands = Array.from(provider.subcommands).join(', ');
      error(`Please specify a valid subcommand: ${subcommands}`);
      provider.help();
    }
  } catch (err) {
    console.error(
      error(
        `An unexpected error occurred in provider ${subcommand}: ${err.stack}`
      )
    );
  }
};
github Yoctol / bottender / packages / bottender / src / cli / index.ts View on Github external
if (argv['--help']) {
    provider.help();
    process.exit(0);
  }

  // the context object to supply to the providers or the commands
  const ctx: CliContext = {
    config: null, // FIXME
    argv,
  };

  try {
    const method = get(provider, camelcase(subcommand));
    if (method) {
      await (provider as any)[camelcase(subcommand)](ctx);
    } else {
      const subcommands = Array.from(provider.subcommands).join(', ');
      error(`Please specify a valid subcommand: ${subcommands}`);
      provider.help();
    }
  } catch (err) {
    console.error(
      error(
        `An unexpected error occurred in provider ${subcommand}: ${err.stack}`
      )
    );
  }
};