Skip to content

Commit

Permalink
[minor] Use fs.exists when available
Browse files Browse the repository at this point in the history
`path.exists*` was moved to `fs` module in
nodejs/node-v0.x-archive@e10ed09.
  • Loading branch information
mmalecki committed May 15, 2012
1 parent 1f67d35 commit 87b0dd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/nconf/stores/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var fs = require('fs'),
util = require('util'),
formats = require('../formats'),
Memory = require('./memory').Memory,
exists = fs.exists || path.exists,
existsSync = fs.existsSync || path.existsSync;

//
Expand Down Expand Up @@ -82,7 +83,7 @@ File.prototype.saveSync = function (value) {
File.prototype.load = function (callback) {
var self = this;

path.exists(self.file, function (exists) {
exists(self.file, function (exists) {
if (!exists) {

This comment has been minimized.

Copy link
@MiniGod

MiniGod May 19, 2012

Function and variable with same name.

This comment has been minimized.

Copy link
@chjj

chjj May 19, 2012

Contributor

@MiniGod, that shouldn't matter because exists isn't called from within the callback. Whether variable shadowing is best practice is a different question. It's fine in my opinion.

return callback(null, {});
}
Expand Down

0 comments on commit 87b0dd0

Please sign in to comment.