How to use the @tanker/core.errors.InvalidArgument function in @tanker/core

To help you get started, we’ve selected a few @tanker/core 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 TankerHQ / sdk-js / packages / client-node / src / dataHelpers.js View on Github external
export const assertDataType = (value: any, argName: string): void => {
  if (![ArrayBuffer, Buffer, Uint8Array].some(klass => value instanceof klass))
    throw new errors.InvalidArgument(argName, 'ArrayBuffer | Buffer | Uint8Array', value);
};
github TankerHQ / sdk-js / packages / client-browser / src / dataHelpers.js View on Github external
export const assertDataType = (value: any, argName: string): void => {
  if (![Uint8Array, Blob, File, ArrayBuffer].some(klass => value instanceof klass))
    throw new errors.InvalidArgument(argName, 'ArrayBuffer | Blob | File | Uint8Array', value);
};
github TankerHQ / sdk-js / packages / client-node / src / dataHelpers.js View on Github external
export const castData = (input: Data, outputType: Class): T => {
  if (input instanceof outputType)
    return input;

  const caster = casterMap[outputType.name];
  if (!caster)
    throw new errors.InvalidArgument('outputType', 'ArrayBuffer.prototype | Buffer.prototype | Uint8Array.prototype', outputType.name);

  return caster(input);
};