packages/babel-helper-module-transforms/src/index.js
function buildInitStatement(metadata, exportNames, initExpr) {
  return t.expressionStatement(
    exportNames.reduce(
      (acc, exportName) =>
        template.expression`EXPORTS.NAME = VALUE`({
          EXPORTS: metadata.exportName,
          NAME: exportName,
          VALUE: acc,
        }),
      initExpr,
    ),
  );
}
function buildInitStatement(metadata, exportNames, initExpr) {
  return t.expressionStatement(
    exportNames.reduce(
      (acc, exportName) =>
        template.expression`EXPORTS.NAME = VALUE`({
          EXPORTS: metadata.exportName,
          NAME: exportName,
          VALUE: acc,
        }),
      initExpr,
    ),
  );
}
function buildInitStatement ( metadata , exportNames , initExpr ) { return t . expressionStatement ( exportNames . reduce ( ( acc , exportName ) => template . expression ` ` ( { EXPORTS : metadata . exportName , NAME : exportName , VALUE : acc , } ) , initExpr , ) , ) ; }
Given a set of export names, create a set of nested assignments to
initialize them all to a given expression.
Given a set of export names create a set of nested assignments to initialize them all to a given expression .