@paxperscientiam/national-weather-service-api.ts
Advanced tools
Comparing version 0.3.1-beta.0 to 0.3.1-beta.1
@@ -106,9 +106,7 @@ // tslint:disable:no-console | ||
`) | ||
file.write(`import { stringify } from "query-string" | ||
file.write(`import {format} from "url" | ||
`) | ||
file.write(`import {URL} from "url" | ||
`) | ||
file.write(`export class NWS { | ||
private domain: string = "https://api.weather.gov" | ||
private hostname: string = "api.weather.gov" | ||
private query = {} | ||
@@ -186,6 +184,8 @@ private pathString: string = "" | ||
file.write(`buildURI(): string { | ||
const URI = new URL(this.domain) | ||
URI.pathname = this.pathString | ||
URI.search = stringify(this.query) | ||
return URI.href | ||
return format({ | ||
hostname: this.hostname, | ||
pathname: this.pathString, | ||
protocol: "https", | ||
query: this.query, | ||
}) | ||
} | ||
@@ -192,0 +192,0 @@ `) |
/// <reference path="../src/@types/nwsapi/index.d.ts" /> | ||
export declare class NWS { | ||
private domain; | ||
private hostname; | ||
private query; | ||
@@ -5,0 +5,0 @@ private pathString; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const query_string_1 = require("query-string"); | ||
const url_1 = require("url"); | ||
class NWS { | ||
constructor() { | ||
this.domain = "https://api.weather.gov"; | ||
this.hostname = "api.weather.gov"; | ||
this.query = {}; | ||
@@ -148,6 +147,8 @@ this.pathString = ""; | ||
buildURI() { | ||
const URI = new url_1.URL(this.domain); | ||
URI.pathname = this.pathString; | ||
URI.search = query_string_1.stringify(this.query); | ||
return URI.href; | ||
return url_1.format({ | ||
hostname: this.hostname, | ||
pathname: this.pathString, | ||
protocol: "https", | ||
query: this.query, | ||
}); | ||
} | ||
@@ -154,0 +155,0 @@ setPath(pathString) { |
{ | ||
"name": "@paxperscientiam/national-weather-service-api.ts", | ||
"version": "0.3.1-beta.0", | ||
"version": "0.3.1-beta.1", | ||
"description": "Provides types for the US National Weather Service's forecast API and a helpful URI builder.", | ||
@@ -40,3 +40,4 @@ "homepage": "https://github.com/paxperscientiam/national-weather-service-types", | ||
"dependencies": { | ||
"query-string": "^6.8.3" | ||
"query-string": "^6.8.3", | ||
"url": "^0.11.0" | ||
}, | ||
@@ -43,0 +44,0 @@ "files": [ |
/// <reference path="./@types/nwsapi/index.d.ts" /> | ||
/// <reference types="node" /> | ||
import { stringify } from "query-string" | ||
import {URL} from "url" | ||
import {format} from "url" | ||
export class NWS { | ||
private domain: string = "https://api.weather.gov" | ||
private hostname: string = "api.weather.gov" | ||
private query = {} | ||
@@ -194,6 +193,8 @@ private pathString: string = "" | ||
buildURI(): string { | ||
const URI = new URL(this.domain) | ||
URI.pathname = this.pathString | ||
URI.search = stringify(this.query) | ||
return URI.href | ||
return format({ | ||
hostname: this.hostname, | ||
pathname: this.pathString, | ||
protocol: "https", | ||
query: this.query, | ||
}) | ||
} | ||
@@ -200,0 +201,0 @@ private setPath(pathString: string): this { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14
4078
164660
3
+ Addedurl@^0.11.0
+ Addedobject-inspect@1.13.3(transitive)
+ Addedpunycode@1.4.1(transitive)
+ Addedqs@6.13.1(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedurl@0.11.4(transitive)