import type { Parser , ScopeTransform } from "../api.js" ; import { xform } from "../combinators/xform.js" ; /**
 * Collects results of all direct children into an array, then discards
 * children. Also see  collect .
 *
 *  param scope export const xfCollect = ( scope ) => { scope ! . result = scope ! . children ! . map ( ( c ) => c . result ) ; scope ! . children = null ; return scope ; } ; param parser export const collect = < T > ( parser ) => xform ( parser , xfCollect ) ;