function getNumComponentsForFormat(format) {
    switch (format) {
      case ALPHA:
      case LUMINANCE:
        return 1;
      case LUMINANCE_ALPHA:
        return 2;
      case RGB:
        return 3;
      case RGBA:
        return 4;
      default:
        throw "unknown type: " + format;
    }
  }
Gets the number of compontents for a given image format.
@param {number} format the format.
@return {number} the number of components for the format.
@memberOf module:twgl/textures