function augmentTypedArray(typedArray, numComponents) {
      let cursor = 0;
      typedArray.push = function() {
        for (let ii = 0; ii < arguments.length; ++ii) {
          const value = arguments[ii];
          if (value instanceof Array || (value.buffer && value.buffer instanceof ArrayBuffer)) {
            for (let jj = 0; jj < value.length; ++jj) {
              typedArray[cursor++] = value[jj];
            }
          } else {
            typedArray[cursor++] = value;
          }
        }
      };
      typedArray.reset = function(opt_index) {
        cursor = opt_index || 0;
      };
      typedArray.numComponents = numComponents;
      Object.defineProperty(typedArray, 'numElements', {
        get: function() {
          return this.length / this.numComponents | 0;
        },
      });
      return typedArray;
    }
creates a typed array with a `push` function attached
so that you can easily *push* values.

`push` can take multiple arguments. If an argument is an array each element
of the array will be added to the typed array.

Example:

    let array = createAugmentedTypedArray(3, 2);  // creates a Float32Array with 6 values
    array.push(1, 2, 3);
    array.push([4, 5, 6]);
    // array now contains [1, 2, 3, 4, 5, 6]

Also has `numComponents` and `numElements` properties.

@param {number} numComponents number of components
@param {number} numElements number of elements. The total size of the array will be `numComponents * numElements`.
@param {constructor} opt_type A constructor for the type. Default = `Float32Array`.
@return {ArrayBuffer} A typed array.
@memberOf module:webgl-utils