src/attributes.js
function createBufferFromTypedArray(gl, typedArray, type, drawType) {
  if (helper.isBuffer(gl, typedArray)) {
    return typedArray;
  }
  type = type || gl.ARRAY_BUFFER;
  const buffer = gl.createBuffer();
  setBufferFromTypedArray(gl, type, buffer, typedArray, drawType);
  return buffer;
}
function createBufferFromTypedArray(gl, typedArray, type, drawType) {
  if (helper.isBuffer(gl, typedArray)) {
    return typedArray;
  }
  type = type || gl.ARRAY_BUFFER;
  const buffer = gl.createBuffer();
  setBufferFromTypedArray(gl, type, buffer, typedArray, drawType);
  return buffer;
}
function createBufferFromTypedArray ( gl , typedArray , type , drawType ) { if ( helper . isBuffer ( gl , typedArray ) ) { return typedArray ; } type = type || gl . ARRAY_BUFFER ; const buffer = gl . createBuffer ( ) ; setBufferFromTypedArray ( gl , type , buffer , typedArray , drawType ) ; return buffer ; }
Given typed array creates a WebGLBuffer and copies the typed array
into it.

@param {WebGLRenderingContext} gl A WebGLRenderingContext
@param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView|WebGLBuffer} typedArray the typed array. Note: If a WebGLBuffer is passed in it will just be returned. No action will be taken
@param {number} [type] the GL bind type for the buffer. Default = `gl.ARRAY_BUFFER`.
@param {number} [drawType] the GL draw type for the buffer. Default = 'gl.STATIC_DRAW`.
@return {WebGLBuffer} the created WebGLBuffer
@memberOf module:twgl/attributes
Given typed array creates a WebGLBuffer and copies the typed array into it .