How to use the union.fields function in union

To help you get started, we’ve selected a few union 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 polkadot-js / api / packages / api-contract / src / MetaRegistry.ts View on Github external
function detectedType ({ def, id }: MetaType): MetaTypeInfo {
  assert(!(def as MetaTypeDefUnion)['union.fields'], 'Invalid union type definition found');

  const lookup = def === 'builtin'
    ? builtinMap.find(([test]): boolean => test(id))
    : typeMap.find(([test]): boolean => !!(def as any)[test]);

  return lookup
    ? lookup[1]
    : MetaTypeInfo.Null;
}

union

A hybrid buffered / streaming middleware kernel backwards compatible with connect.

MIT
Latest version published 10 months ago

Package Health Score

77 / 100
Full package analysis