src/attributes.js
function createBuffersFromArrays(gl, arrays) {
  const buffers = { };
  Object.keys(arrays).forEach(function(key) {
    buffers[key] = createBufferFromArray(gl, arrays[key], key);
  });

  // Ugh!
  if (arrays.indices) {
    buffers.numElements = arrays.indices.length;
    buffers.elementType = typedArrays.getGLTypeForTypedArray(makeTypedArray(arrays.indices), 'indices');
  } else {
    buffers.numElements = getNumElementsFromNonIndexedArrays(arrays);
  }

  return buffers;
}
function createBuffersFromArrays(gl, arrays) {
  const buffers = { };
  Object.keys(arrays).forEach(function(key) {
    buffers[key] = createBufferFromArray(gl, arrays[key], key);
  });

  // Ugh!
  if (arrays.indices) {
    buffers.numElements = arrays.indices.length;
    buffers.elementType = typedArrays.getGLTypeForTypedArray(makeTypedArray(arrays.indices), 'indices');
  } else {
    buffers.numElements = getNumElementsFromNonIndexedArrays(arrays);
  }

  return buffers;
}
function createBuffersFromArrays ( gl , arrays ) { const buffers = { } ; Object . keys ( arrays ) . forEach ( function ( key ) { buffers [ key ] = createBufferFromArray ( gl , arrays [ key ] , key ) ; } ) ; // Ugh! if ( arrays . indices ) { buffers . numElements = arrays . indices . length ; buffers . elementType = typedArrays . getGLTypeForTypedArray ( makeTypedArray ( arrays . indices ) , 'indices' ) ; } else { buffers . numElements = getNumElementsFromNonIndexedArrays ( arrays ) ; } return buffers ; }
Creates buffers from arrays or typed arrays

Given something like this

var arrays = {
positions: [1, 2, 3],
normals: [0, 0, 1],
}

returns something like

buffers = {
positions: WebGLBuffer,
normals: WebGLBuffer,
}

If the buffer is named 'indices' it will be made an ELEMENT_ARRAY_BUFFER.

@param {WebGLRenderingContext} gl A WebGLRenderingContext.
@param {module:twgl.Arrays} arrays
@return {Object<string, WebGLBuffer>} returns an object with one WebGLBuffer per array
@memberOf module:twgl/attributes
Creates buffers from arrays or typed arrays