How to use the @tanker/types.getConstructor function in @tanker/types

To help you get started, we’ve selected a few @tanker/types 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 / functional-tests / src / encrypt.js View on Github external
  const expectType = (obj: Object, type: Object) => expect(getConstructor(obj)).to.equal(type);
  const expectSameType = (a: Object, b: Object) => expect(getConstructor(a)).to.equal(getConstructor(b));
github TankerHQ / sdk-js / packages / functional-tests / src / encrypt.js View on Github external
  const expectSameType = (a: Object, b: Object) => expect(getConstructor(a)).to.equal(getConstructor(b));
  const expectDeepEqual = (a: Object, b: Object) => {
github TankerHQ / sdk-js / packages / core / src / DataProtection / options.js View on Github external
export const extractOutputOptions = (options: Object, input?: Data): OutputOptions => {
  if (!isObject(options))
    throw new InvalidArgument('options', '{ type: Class, mime?: string, name?: string, lastModified?: number }', options);

  let outputType;

  if (options.type) {
    outputType = options.type;
  } else if (input) {
    outputType = getConstructor(input);
  } else {
    throw new InternalError('Assertion error: called extractOutputOptions without a type or input');
  }

  const outputOptions = {};
  outputOptions.type = outputType;

  if (globalThis.Blob && input instanceof globalThis.Blob) {
    outputOptions.mime = input.type;
  }
  if (globalThis.File && input instanceof globalThis.File) {
    outputOptions.name = input.name;
    outputOptions.lastModified = input.lastModified;
  }

  if (typeof options.mime === 'string') {

@tanker/types

Tanker SDK (types)

Apache-2.0
Latest version published 5 months ago

Package Health Score

65 / 100
Full package analysis

Similar packages