Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

os: rename os.tmpDir to os.tmpdir

Make function name consistent with other functions from the os module.

Fixes #4622.
  • Loading branch information...
commit 4f9a07dbf2817fb3c9e18dee998740308f03de8e 1 parent 8b0f3ce
@bnoordhuis authored
Showing with 9 additions and 5 deletions.
  1. +5 −1 lib/os.js
  2. +4 −4 test/simple/test-os.js
View
6 lib/os.js
@@ -41,13 +41,17 @@ exports.platform = function() {
return process.platform;
};
-exports.tmpDir = function() {
+exports.tmpdir = function() {
return process.env.TMPDIR ||
process.env.TMP ||
process.env.TEMP ||
(process.platform === 'win32' ? 'c:\\windows\\temp' : '/tmp');
};
+exports.tmpDir = util.deprecate(function() {
+ return exports.tmpdir();
+}, 'os.tmpDir is now called `os.tmpdir`.');
+
exports.getNetworkInterfaces = util.deprecate(function() {
return exports.networkInterfaces();
}, 'getNetworkInterfaces is now called `os.networkInterfaces`.');
View
8 test/simple/test-os.js
@@ -31,13 +31,13 @@ process.env.TMPDIR = '/tmpdir';
process.env.TMP = '/tmp';
process.env.TEMP = '/temp';
var t = ( process.platform === 'win32' ? 'c:\\windows\\temp' : '/tmp' );
-assert.equal(os.tmpDir(), '/tmpdir');
+assert.equal(os.tmpdir(), '/tmpdir');
process.env.TMPDIR = '';
-assert.equal(os.tmpDir(), '/tmp');
+assert.equal(os.tmpdir(), '/tmp');
process.env.TMP = '';
-assert.equal(os.tmpDir(), '/temp');
+assert.equal(os.tmpdir(), '/temp');
process.env.TEMP = '';
-assert.equal(os.tmpDir(), t);
+assert.equal(os.tmpdir(), t);
var endianness = os.endianness();
console.log('endianness = %s', endianness);

1 comment on commit 4f9a07d

Please sign in to comment.
Something went wrong with that request. Please try again.