Browse Source

os: rename getNetworkInterfaces() to networkInterfaces()

v0.7.4-release
Ben Noordhuis 13 years ago
parent
commit
37bb37d151
  1. 2
      doc/api/os.markdown
  2. 12
      lib/os.js
  3. 2
      test/simple/test-os.js

2
doc/api/os.markdown

@ -109,7 +109,7 @@ Example inspection of os.cpus:
idle: 1072572010, idle: 1072572010,
irq: 30 } } ] irq: 30 } } ]
### os.getNetworkInterfaces() ### os.networkInterfaces()
Get a list of network interfaces: Get a list of network interfaces:

12
lib/os.js

@ -29,10 +29,20 @@ exports.totalmem = binding.getTotalMem;
exports.cpus = binding.getCPUs; exports.cpus = binding.getCPUs;
exports.type = binding.getOSType; exports.type = binding.getOSType;
exports.release = binding.getOSRelease; exports.release = binding.getOSRelease;
exports.getNetworkInterfaces = binding.getInterfaceAddresses; exports.networkInterfaces = binding.getInterfaceAddresses;
exports.arch = function() { exports.arch = function() {
return process.arch; return process.arch;
}; };
exports.platform = function() { exports.platform = function() {
return process.platform; return process.platform;
}; };
var warnNetworkInterfaces = true;
exports.getNetworkInterfaces = function() {
if (warnNetworkInterfaces) {
console.error("os.getNetworkInterfaces() is deprecated - use os.networkInterfaces()");
console.trace();
warnNetworkInterfaces = false;
}
return exports.networkInterfaces();
};

2
test/simple/test-os.js

@ -63,7 +63,7 @@ if (process.platform != 'sunos') {
} }
var interfaces = os.getNetworkInterfaces(); var interfaces = os.networkInterfaces();
console.error(interfaces); console.error(interfaces);
switch (platform) { switch (platform) {
case 'linux': case 'linux':

Loading…
Cancel
Save