1 | "use strict";
|
2 |
|
3 | const os = require("os");
|
4 | const platform = os.platform();
|
5 |
|
6 | if (["aix", "android", "darwin", "freebsd", "linux", "openbsd", "sunos", "win32"].includes(platform)) {
|
7 | let file;
|
8 | if (platform === "aix") {
|
9 |
|
10 | file = `${os.type() === "OS400" ? "ibmi" : "sunos"}.js`;
|
11 | } else {
|
12 | file = `${platform}.js`;
|
13 | }
|
14 |
|
15 | const m = require(`./${file}`);
|
16 | module.exports.v4 = () => m.v4();
|
17 | module.exports.v6 = () => m.v6();
|
18 | module.exports.v4.sync = () => m.v4.sync();
|
19 | module.exports.v6.sync = () => m.v6.sync();
|
20 | } else {
|
21 | const unsupported = () => { throw new Error(`Unsupported Platform: ${platform}`); };
|
22 | module.exports.v4 = unsupported;
|
23 | module.exports.v6 = unsupported;
|
24 | module.exports.v4.sync = unsupported;
|
25 | module.exports.v6.sync = unsupported;
|
26 | }
|