Skip to content

Commit 3f7d219

Browse files
authored
fix lint error and format (#61)
1 parent 20afe82 commit 3f7d219

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/cli.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as net from "net";
33
import cosmosDBServer from ".";
44

55
const argv = process.argv.slice(2);
6-
const args: { help?: boolean; port?: number, hostname?: string } = {};
6+
const args: { help?: boolean; port?: number; hostname?: string } = {};
77
while (argv.length) {
88
const key = argv.shift();
99
switch (key) {
@@ -39,11 +39,12 @@ Options:
3939

4040
const server = cosmosDBServer().listen(args.port, args.hostname, () => {
4141
const { address, family, port } = server.address() as net.AddressInfo;
42-
const hostname = args.hostname ? args.hostname : (
43-
family === "IPv6" ? `[${address}]` : address
44-
);
42+
// eslint-disable-next-line no-nested-ternary
43+
const hostname = args.hostname
44+
? args.hostname
45+
: family === "IPv6"
46+
? `[${address}]`
47+
: address;
4548
// eslint-disable-next-line no-console
46-
console.log(
47-
`Ready to accept connections at ${hostname}:${port}`
48-
);
49+
console.log(`Ready to accept connections at ${hostname}:${port}`);
4950
});

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export default (opts?: ServerOptions) => {
7878
}).on("listening", () => {
7979
const address = server.address();
8080
if (typeof address === "object" && address) {
81-
const { address:host, port } = address as net.AddressInfo;
82-
const hostname = (host == '0.0.0.0' || host == '::') ? 'localhost' : host;
81+
const { address: host, port } = address as net.AddressInfo;
82+
const hostname = host === "0.0.0.0" || host === "::" ? "localhost" : host;
8383

8484
account = new Account(hostname, port);
8585
} else {

0 commit comments

Comments
 (0)