-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnputil.js
More file actions
25 lines (22 loc) · 725 Bytes
/
Copy pathnputil.js
File metadata and controls
25 lines (22 loc) · 725 Bytes
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
/*!
* NodePing
* Copyright(c) 2020 NodePing LLC
*/
// Get the type of a thing. typeof with added tests for null, array, and NaN
// See http://davidcaylor.com/2011/03/05/testing-variable-types-in-javascript/
var gettype = exports.gettype = function(thing){
return (thing === null) ? "null" :
(typeof thing == "object" && thing.length !== undefined) ? "array" :
(typeof thing == "number" && isNaN(thing)) ? "NaN" :
typeof thing;
};
var isEmptyObject = exports.isEmptyObject = function(obj){
for(var prop in obj) {
if(obj.hasOwnProperty(prop))
return false;
}
return true;
};
var isNumeric = exports.isNumeric = function(n){
return !isNaN(parseFloat(n)) && isFinite(n);
};