How to use the @tanker/global-this.ArrayBuffer function in @tanker/global-this

To help you get started, we’ve selected a few @tanker/global-this 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 / types / src / data-types.js View on Github external
const dataTypeDefs = (() => {
  const defs = [];
  if (globalThis.ArrayBuffer !== undefined)
    defs.push({ type: ArrayBuffer, lengthOf: (arg: ArrayBuffer) => arg.byteLength });
  if (globalThis.Buffer !== undefined)
    defs.push({ type: Buffer, lengthOf: (arg: Buffer) => arg.length }); // MUST be before Uint8Array
  if (globalThis.Uint8Array !== undefined)
    defs.push({ type: Uint8Array, lengthOf: (arg: Uint8Array) => arg.length });
  if (globalThis.File !== undefined) {
    defs.push({ type: File, lengthOf: (arg: File) => arg.size }); // MUST be before FilePonyfill and Blob
    defs.push({ type: FilePonyfill, lengthOf: (arg: FilePonyfill) => arg.size }); // MUST be before Blob
  }
  if (globalThis.Blob !== undefined)
    defs.push({ type: Blob, lengthOf: (arg: Blob) => arg.size });
  return defs;
})();

@tanker/global-this

Tanker SDK (global-this)

Apache-2.0
Latest version published 6 months ago

Package Health Score

61 / 100
Full package analysis

Similar packages