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.
		
		
		
		
		
			
		
			
				
					27 lines
				
				771 B
			
		
		
			
		
	
	
					27 lines
				
				771 B
			| 
								 
											3 years ago
										 
									 | 
							
								"use strict";
							 | 
						||
| 
								 | 
							
								Object.defineProperty(exports, "__esModule", { value: true });
							 | 
						||
| 
								 | 
							
								//return first eol found from a data chunk.
							 | 
						||
| 
								 | 
							
								function default_1(data, param) {
							 | 
						||
| 
								 | 
							
								    if (!param.eol && data) {
							 | 
						||
| 
								 | 
							
								        for (var i = 0, len = data.length; i < len; i++) {
							 | 
						||
| 
								 | 
							
								            if (data[i] === "\r") {
							 | 
						||
| 
								 | 
							
								                if (data[i + 1] === "\n") {
							 | 
						||
| 
								 | 
							
								                    param.eol = "\r\n";
							 | 
						||
| 
								 | 
							
								                    break;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								                else if (data[i + 1]) {
							 | 
						||
| 
								 | 
							
								                    param.eol = "\r";
							 | 
						||
| 
								 | 
							
								                    break;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								            else if (data[i] === "\n") {
							 | 
						||
| 
								 | 
							
								                param.eol = "\n";
							 | 
						||
| 
								 | 
							
								                break;
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    return param.eol || "\n";
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								exports.default = default_1;
							 | 
						||
| 
								 | 
							
								;
							 | 
						||
| 
								 | 
							
								//# sourceMappingURL=getEol.js.map
							 |