Skip to content

Commit

Permalink
Fixes the stuff style told me about
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkar598 committed Mar 23, 2022
1 parent f342517 commit 213844a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 5 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface SocketConfig {
//Port to connect to
port: number;
}
export type SingleRunConfiguration = SocketConfig & {
export interface SingleRunConfiguration extends SocketConfig {
//URL params to send to BYOND
topic: string;
//Time to wait before aborting connection
Expand Down Expand Up @@ -132,7 +132,7 @@ function _sendTopic(socket: Socket, _topic: string): Promise<TopicReturnType> {
})
}

function sendTopic(config: SingleRunConfiguration): Promise<TopicReturnType> {
export function sendTopic(config: SingleRunConfiguration): Promise<TopicReturnType> {
const socket = createConnection({
family: 4,
host: config.host,
Expand All @@ -142,8 +142,8 @@ function sendTopic(config: SingleRunConfiguration): Promise<TopicReturnType> {
return _sendTopic(socket, config.topic)
}

function createTopicConnection(config: SocketConfig): TopicConnection {
let socket = createConnection({
export function createTopicConnection(config: SocketConfig): TopicConnection {
const socket = createConnection({
family: 4,
host: config.host,
port: config.port
Expand All @@ -160,6 +160,4 @@ function createTopicConnection(config: SocketConfig): TopicConnection {
socket.destroy()
}
}
}

export { sendTopic, createTopicConnection }
}
9 changes: 4 additions & 5 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ export interface SocketConfig {
host: string;
port: number;
}
export declare type SingleRunConfiguration = SocketConfig & {
export interface SingleRunConfiguration extends SocketConfig {
topic: string;
timeout?: number;
};
}
export declare type TopicReturnType = string | number | null;
export interface TopicConnection {
send: (topic: string) => Promise<TopicReturnType>;
destroy: () => void;
}
declare function sendTopic(config: SingleRunConfiguration): Promise<TopicReturnType>;
declare function createTopicConnection(config: SocketConfig): TopicConnection;
export { sendTopic, createTopicConnection };
export declare function sendTopic(config: SingleRunConfiguration): Promise<TopicReturnType>;
export declare function createTopicConnection(config: SocketConfig): TopicConnection;

0 comments on commit 213844a

Please sign in to comment.