From 37bb37d151fb6ee4696730e63ff28bb7a4924f97 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 1 Nov 2011 17:23:17 +0100 Subject: [PATCH] os: rename getNetworkInterfaces() to networkInterfaces() --- doc/api/os.markdown | 2 +- lib/os.js | 12 +++++++++++- test/simple/test-os.js | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/api/os.markdown b/doc/api/os.markdown index eff85200ddb..02823acfff6 100644 --- a/doc/api/os.markdown +++ b/doc/api/os.markdown @@ -109,7 +109,7 @@ Example inspection of os.cpus: idle: 1072572010, irq: 30 } } ] -### os.getNetworkInterfaces() +### os.networkInterfaces() Get a list of network interfaces: diff --git a/lib/os.js b/lib/os.js index b9b04ec8697..fa8ac01513f 100644 --- a/lib/os.js +++ b/lib/os.js @@ -29,10 +29,20 @@ exports.totalmem = binding.getTotalMem; exports.cpus = binding.getCPUs; exports.type = binding.getOSType; exports.release = binding.getOSRelease; -exports.getNetworkInterfaces = binding.getInterfaceAddresses; +exports.networkInterfaces = binding.getInterfaceAddresses; exports.arch = function() { return process.arch; }; exports.platform = function() { 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(); +}; diff --git a/test/simple/test-os.js b/test/simple/test-os.js index 225351ac881..2719382df08 100644 --- a/test/simple/test-os.js +++ b/test/simple/test-os.js @@ -63,7 +63,7 @@ if (process.platform != 'sunos') { } -var interfaces = os.getNetworkInterfaces(); +var interfaces = os.networkInterfaces(); console.error(interfaces); switch (platform) { case 'linux':