Skip to content

Commit 2d06d4e

Browse files
committed
Extract common config to a const
1 parent 4b0be42 commit 2d06d4e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/tmp.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ function _randomChars(howMany: number) {
121121
* @private
122122
*/
123123
function _generateTmpName(opts: Options) {
124+
const tmpDir = opts.dir || TMP_DIR;
125+
124126
if (opts.name) {
125-
return path.join(opts.dir || TMP_DIR, opts.name);
127+
return path.join(tmpDir, opts.name);
126128
}
127129

128130
// mkstemps like template
@@ -138,7 +140,7 @@ function _generateTmpName(opts: Options) {
138140
opts.postfix || ''
139141
].join('');
140142

141-
return path.join(opts.dir || TMP_DIR, name);
143+
return path.join(tmpDir, name);
142144
}
143145

144146
/**

0 commit comments

Comments
 (0)