2014-05-16 00:33:34 +00:00
|
|
|
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;
|
2014-05-29 22:30:03 +00:00
|
|
|
if(arr && typeof arr === "string") o[obj[k][arr]] = k;
|
2014-05-16 00:33:34 +00:00
|
|
|
if(!arr) o[obj[k]] = k;
|
|
|
|
else (o[obj[k]]=o[obj[k]]||[]).push(k);
|
|
|
|
});
|
|
|
|
return o;
|
|
|
|
}
|
2014-05-22 12:16:51 +00:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
}
|