From c8293dcec57f6bc6c26787cfa708339d393c6ba6 Mon Sep 17 00:00:00 2001 From: oceanroleplay Date: Tue, 7 Sep 2021 02:39:12 +0530 Subject: [PATCH] IDef --- package.json | 2 +- src/Identifiers.ts | 4 +++- src/client.ts | 3 ++- src/types/common.ts | 4 ++++ src/types/index.ts | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 src/types/common.ts diff --git a/package.json b/package.json index 0e43516..601f971 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aviationweather", - "version": "1.1.5", + "version": "1.1.6", "description": "Node.js wrapper for aviation weather, written in TypeScript", "main": "build/index.js", "types": "build/index.d.ts", diff --git a/src/Identifiers.ts b/src/Identifiers.ts index b3f3d43..440460b 100644 --- a/src/Identifiers.ts +++ b/src/Identifiers.ts @@ -1,4 +1,6 @@ -export const skyConditions: { code: string; meaning: string }[] = [ +import { IDef } from "."; + +export const skyConditions: IDef[] = [ { code: "BKN", meaning: "Broken cloud layer 5/8ths to 7/8ths" }, { code: "CB", meaning: "Cumulonimbus" }, { code: "CLR", meaning: "Sky clear at or below 12,000AGL" }, diff --git a/src/client.ts b/src/client.ts index c2c0f09..42245f5 100644 --- a/src/client.ts +++ b/src/client.ts @@ -6,6 +6,7 @@ import { IAircraftReportsOptions, IClientOptions, IDatasourceType, + IDef, IGAirMet, IGAirmetOptions, IMetar, @@ -31,7 +32,7 @@ export class Client { this.options = options; } - private getDef(identifier: string) { + getDef(identifier: string): IDef { const search = skyConditions.find((s) => s.code === identifier); if (!search) return { code: identifier, meaning: "unknown" }; return search; diff --git a/src/types/common.ts b/src/types/common.ts new file mode 100644 index 0000000..557d301 --- /dev/null +++ b/src/types/common.ts @@ -0,0 +1,4 @@ +export interface IDef { + code: string; + meaning: string; +} diff --git a/src/types/index.ts b/src/types/index.ts index 08e3d0f..4d6f19a 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,3 +1,4 @@ export * from "./options"; export * from "./responses"; export * from "./client"; +export * from "./common";