UNPKG

355 BJavaScriptView Raw
1import { lazyMethod } from '@polkadot/util';
2export function lazyVariants(lookup, { type }, getName, creator) {
3 const result = {};
4 const variants = lookup.getSiType(type).def.asVariant.variants;
5 for (let i = 0, count = variants.length; i < count; i++) {
6 lazyMethod(result, variants[i], creator, getName, i);
7 }
8 return result;
9}