forked from miaulightouch/default-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (36 loc) · 1.1 KB
/
Copy pathindex.js
File metadata and controls
40 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
const { type } = require("os");
const supportedPlatforms = new Set([
"aix",
"android",
"darwin",
"freebsd",
"linux",
"openbsd",
"sunos",
"win32"
]);
if (supportedPlatforms.has(process.platform)) {
const m = (() => {
switch (process.platform) {
case 'android': return require('./android');
case 'darwin': return require('./darwin');
case 'freebsd': return require('./freebsd');
case 'linux': return require('./linux');
case 'openbsd': return require('./openbsd');
case 'win32': return require('./win32');
case 'aix':
return type() === 'OS400' ? require('./ibmi') : require('./sunos');
}
})();
module.exports.v4 = () => m.v4();
module.exports.v6 = () => m.v6();
module.exports.v4.sync = () => m.v4.sync();
module.exports.v6.sync = () => m.v6.sync();
} else {
const err = new Error(`Unsupported Platform: ${process.platform}`);
module.exports.v4 = () => Promise.reject(err);
module.exports.v6 = () => Promise.reject(err);
module.exports.v4.sync = () => { throw err; };
module.exports.v6.sync = () => { throw err; };
}