forked from sheetjs/sheetjs
		
	- eliminated functional constructs in hot functions - format try-catch block extracted into new function - cpexcel + codepage updated to 1.2.0 - more efficient (and correct) clean implementation of RGB/HSL/tint algorithms - xlsx binary --all option enables every extra formatting and saving option - column widths parsed and saved (requires cellStyles:true)
		
			
				
	
	
		
			22 lines
		
	
	
		
			609 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			609 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function isval(x) { return typeof x !== "undefined" && x !== null; }
 | |
| 
 | |
| function keys(o) { return Object.keys(o).filter(function(x) { return o.hasOwnProperty(x); }); }
 | |
| 
 | |
| function evert(obj, arr) {
 | |
| 	var o = {};
 | |
| 	keys(obj).forEach(function(k) {
 | |
| 		if(!obj.hasOwnProperty(k)) return;
 | |
| 		if(arr && typeof arr === "string") o[obj[k][arr]] = k;
 | |
| 		if(!arr) o[obj[k]] = k;
 | |
| 		else (o[obj[k]]=o[obj[k]]||[]).push(k);
 | |
| 	});
 | |
| 	return o;
 | |
| }
 | |
| 
 | |
| /* TODO: date1904 logic */
 | |
| function datenum(v, date1904) {
 | |
| 	if(date1904) v+=1462;
 | |
| 	var epoch = Date.parse(v);
 | |
| 	return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
 | |
| }
 |