You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			12 lines
		
	
	
		
			298 B
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			12 lines
		
	
	
		
			298 B
		
	
	
	
		
			JavaScript
		
	
exports.stringToArrayBuffer = string => {
 | 
						|
  if (typeof string !== 'string') {
 | 
						|
    throw new TypeError("'string' must be a string");
 | 
						|
  }
 | 
						|
 | 
						|
  const array = new Uint8Array(string.length);
 | 
						|
  for (let i = 0; i < string.length; i += 1) {
 | 
						|
    array[i] = string.charCodeAt(i);
 | 
						|
  }
 | 
						|
  return array.buffer;
 | 
						|
};
 |