import { OutputFormat } from '..' ; internal export const cartesian = ( ... a ) => a . reduce ( ( a , b ) => a . flatMap ( ( d ) => b . map ( ( e ) => [ d , e ] . flat ( ) ) ) ) ; param entries returns export function resolveConfigs ( entries , outputFormats ) { const singleArgumentEntries = entries . filter ( ( [ k ] ) => ! ( k in outputFormats ) ) . map ( ( [ key , values ] ) => values . map < [ [ string , string ] ] > ( ( v ) => [ [ key , v ] ] ) ) ; const combinations = singleArgumentEntries . reduce ( ( prev , cur ) => ( prev . length ? cartesian ( prev , cur ) : cur ) , [ ] ) ; const metadataAddons = entries . filter ( ( [ k ] ) => k in outputFormats ) ; const out = combinations . map ( ( options ) => Object . fromEntries ( [ ... options , ... metadataAddons ] ) ) ; return out . length ? out : [ Object . fromEntries ( metadataAddons ) ] ; }