-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatasniffer.html
32 lines (29 loc) · 1.13 KB
/
datasniffer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<html>
<head>
<script>
function sniff(data) {
//remove the sign
let num = Math.abs(data);
//if the number is in scientific notation remove it
if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) {
return "Scientific Notation"
}
if (parseInt(data) === data) {
if (data > 999999999) {
return "Possible Unix Datestamp";
// check if it's exactly at midnight on any date - probable date
// check if it's exactly at the top of an hour on any date - probable date
// check if it's exactly at a quarter hour on any date - probable date
// check if it's exactly at a minute at any date - probable date
}
return "Integer";
}
if (parseFloat(data) === data) {
return "Float";
}
return "String";
}
window.sniff = sniff;
</script>
</head>
</html>