mwg API
    Preparing search index...

    Function readChildren

    • Collect children without making every game adapter repeat this filter.

      Type Parameters

      • T

      Parameters

      Returns MwlReadResult<readonly T[]>

      import { compile, readAttributes, readChildren } from '@datamoc/mw_games/mwl';

      const game = compile("[{ tag: 'game', schema: 0.1, children: [{ tag: 'side', id: 1 }] }]");
      const sides = readChildren(game.roots[0]!, 'side', (child) => readAttributes(child, { id: { type: 'id' } }));
      console.log(sides.value.length); // 1