You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					23 lines
				
				528 B
			
		
		
			
		
	
	
					23 lines
				
				528 B
			| 
											2 years ago
										 | "use strict"; | ||
|  | 
 | ||
|  | // eslint-disable-next-line node/no-unsupported-features/node-builtins
 | ||
|  | var textEncoder = typeof TextEncoder === 'undefined' ? null : new TextEncoder('utf-8'); | ||
|  | 
 | ||
|  | var _require = require('buffer'), | ||
|  |     Buffer = _require.Buffer; | ||
|  | 
 | ||
|  | function stringToBuffer(str) { | ||
|  |   if (typeof str !== 'string') { | ||
|  |     return str; | ||
|  |   } | ||
|  | 
 | ||
|  |   if (textEncoder) { | ||
|  |     return Buffer.from(textEncoder.encode(str).buffer); | ||
|  |   } | ||
|  | 
 | ||
|  |   return Buffer.from(str); | ||
|  | } | ||
|  | 
 | ||
|  | exports.stringToBuffer = stringToBuffer; | ||
|  | //# sourceMappingURL=browser-buffer-encode.js.map
 |