Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
};
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);
};
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);
};