commander#InvalidArgumentError TypeScript Examples

The following examples show how to use commander#InvalidArgumentError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: candy-machine-v2-cli.ts    From metaplex with Apache License 2.0 6 votes vote down vote up
// From commander examples
function myParseInt(value) {
  // parseInt takes a string and a radix
  const parsedValue = parseInt(value, 10);
  if (isNaN(parsedValue)) {
    throw new InvalidArgumentError('Not a number.');
  }
  return parsedValue;
}
Example #2
Source File: index.ts    From tzklar-boilerplate with MIT License 5 votes vote down vote up
function parseInteger(value: string): number {
  const parsedValue = parseInt(value, 10);
  if (isNaN(parsedValue)) throw new InvalidArgumentError("Not an integer");
  return parsedValue;
}
Example #3
Source File: index.ts    From tzklar-boilerplate with MIT License 5 votes vote down vote up
validateSyntax = (value: string) => {
  if (!Object.keys(CONTRACT_SYNTAXES).includes(value)) {
    throw new InvalidArgumentError("Not supported syntax");
  }
  return value;
}