Comparing version 1.1.0 to 1.2.0
@@ -83,2 +83,10 @@ 'use strict'; | ||
/** | ||
* Generate a nonce string | ||
* @return {String} a nonce string. | ||
*/ | ||
exports.makeNonce = function () { | ||
return '' + Math.floor(Math.random() * 1000000000000); | ||
}; | ||
/** | ||
* Pad a number as \d\d format | ||
@@ -155,1 +163,23 @@ * @param {Number} num a number that less than 100. | ||
}; | ||
/** | ||
* Get the Mac address | ||
* @return {String} the Mac address | ||
*/ | ||
exports.getMac = function () { | ||
var interfaces = os.networkInterfaces(); | ||
var keys = Object.keys(interfaces); | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
var addresses = interfaces[key]; | ||
for (var j = 0; j < addresses.length; j++) { | ||
var item = addresses[j]; | ||
if (!item.internal && item.family === 'IPv4') { | ||
return item.mac; | ||
} | ||
} | ||
} | ||
// without non-internal address | ||
return '00:00:00:00:00:00'; | ||
}; |
{ | ||
"name": "kitx", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "toolkit", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7359
166