Skip to content

Commit 8fae3c4

Browse files
committed
lib: further cleanup platform utility methods
1 parent 777d5d3 commit 8fae3c4

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lib/fs.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ const {
9494
},
9595
SideEffectFreeRegExpPrototypeExec,
9696
defineLazyProperties,
97+
isWindows,
98+
isMacOS,
9799
} = require('internal/util');
98100
const {
99101
constants: {
@@ -167,9 +169,6 @@ let kResistStopPropagation;
167169
let FileReadStream;
168170
let FileWriteStream;
169171

170-
const isWindows = process.platform === 'win32';
171-
const isOSX = process.platform === 'darwin';
172-
173172
function showTruncateDeprecation() {
174173
if (truncateWarn) {
175174
process.emitWarning(
@@ -2442,7 +2441,7 @@ function watch(filename, options, listener) {
24422441
// TODO(anonrig): Remove non-native watcher when/if libuv supports recursive.
24432442
// As of November 2022, libuv does not support recursive file watch on all platforms,
24442443
// e.g. Linux due to the limitations of inotify.
2445-
if (options.recursive && !isOSX && !isWindows) {
2444+
if (options.recursive && !isMacOS && !isWindows) {
24462445
const nonNativeWatcher = require('internal/fs/recursive_watch');
24472446
watcher = new nonNativeWatcher.FSWatcher(options);
24482447
watcher[watchers.kFSWatchStart](path);

lib/net.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ const {
115115
} = require('internal/errors');
116116
const { isUint8Array } = require('internal/util/types');
117117
const { queueMicrotask } = require('internal/process/task_queues');
118-
const { kEmptyObject, guessHandleType, promisify } = require('internal/util');
118+
const {
119+
kEmptyObject,
120+
guessHandleType,
121+
promisify,
122+
isWindows
123+
} = require('internal/util');
119124
const {
120125
validateAbortSignal,
121126
validateBoolean,
@@ -142,8 +147,6 @@ const { kTimeout } = require('internal/timers');
142147
const DEFAULT_IPV4_ADDR = '0.0.0.0';
143148
const DEFAULT_IPV6_ADDR = '::';
144149

145-
const isWindows = process.platform === 'win32';
146-
147150
const noop = () => {};
148151

149152
const kPerfHooksNetConnectContext = Symbol('kPerfHooksNetConnectContext');

lib/os.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const {
3333

3434
const { safeGetenv } = internalBinding('credentials');
3535
const constants = internalBinding('constants').os;
36-
const isWindows = process.platform === 'win32';
36+
const { isWindows } = require('internal/util');
3737

3838
const {
3939
codes: {

0 commit comments

Comments
 (0)