function createPrograms(gl, programSpecs) {
  var programOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  // Remember existing shaders so that if there is an error we don't delete them
  var noDeleteShadersSet = new Set();

  // compile and link everything
  var programs = Object.fromEntries(Object.entries(programSpecs).map(function (_ref7) {
    var _ref8 = _slicedToArray(_ref7, 2),
      name = _ref8[0],
      spec = _ref8[1];
    var options = _objectSpread({}, programOptions);
    var shaders = Array.isArray(spec) ? spec : spec.shaders;
    if (!Array.isArray(spec)) {
      Object.assign(options, spec);
    }
    shaders.forEach(noDeleteShadersSet.add, noDeleteShadersSet);
    return [name, createProgramNoCheck(gl, shaders, options)];
  }));
  if (programOptions.callback) {
    waitForAllProgramsLinkCompletionAsync(gl, programs).then(function () {
      var errors = checkAllPrograms(gl, programs, programSpecs, noDeleteShadersSet, programOptions);
      programOptions.callback(errors, errors ? undefined : programs);
    });
    return undefined;
  }
  var errors = checkAllPrograms(gl, programs, programSpecs, noDeleteShadersSet, programOptions);
  return errors ? undefined : programs;
}
Creates multiple programs

Note: the reason this function exists is because the fastest way to create multiple
programs in WebGL is to create and compile all shaders and link all programs and only
afterwards check if they succeeded. In that way, giving all your shaders

@see {@link module:twgl.createProgram}

Example:

    const programs = twgl.createPrograms(gl, {
      lambert: [lambertVS, lambertFS],
      phong: [phongVS, phoneFS],
      particles: {
        shaders: [particlesVS, particlesFS],
        transformFeedbackVaryings: ['position', 'velocity'],
      },
    });

@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {Object.<string, module:twgl.ProgramSpec>} programSpecs An object of ProgramSpecs, one per program.
@param {module:twgl.ProgramOptions} [programOptions] options to apply to all programs
@return {Object.<string, WebGLProgram>?} the created programInfos by name