Skip to content

Commit 5e7773e

Browse files
committed
Remove isUndefined
1 parent 2d0d596 commit 5e7773e

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

lib/tmp.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,6 @@ function _randomChars(howMany: number) {
102102
return value.join('');
103103
}
104104

105-
/**
106-
* Checks whether the `obj` parameter is defined or not.
107-
*
108-
* @param {Object} obj
109-
* @returns {boolean} true if the object is undefined
110-
* @private
111-
*/
112-
function _isUndefined(obj: any) {
113-
return typeof obj === 'undefined';
114-
}
115-
116105
/**
117106
* Generates a new temporary name.
118107
*
@@ -237,7 +226,7 @@ function file(callbackOrOptions: FileOptions | FileCallback, callback?: FileCall
237226
cb = callback || emptyCallback;
238227
}
239228

240-
opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;
229+
opts.postfix = (typeof opts.postfix == 'undefined') ? '.tmp' : opts.postfix;
241230

242231
// gets a temporary filename
243232
tmpName(opts, function _tmpNameCreated(err, name) {
@@ -380,7 +369,7 @@ function dir(callbackOrOptions: DirOptions | DirCallback, callback?: DirCallback
380369
* @throws {Error} if it cannot create a directory
381370
*/
382371
function dirSync(options: DirOptions) {
383-
const opts: DirOptions = typeof options == 'undefined' ? {} : options;
372+
const opts: DirOptions = (typeof options == 'undefined') ? {} : options;
384373

385374
const name = tmpNameSync(opts);
386375
fs.mkdirSync(name, opts.mode || DIR_MODE);

0 commit comments

Comments
 (0)