UNPKG

node-clima

Version:

Simple wrapper for OpenWeatherMap API

20 lines (19 loc) 654 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); // clientrequest.ts const node_fetch_1 = __importDefault(require("node-fetch")); class ClientRequest { makeRequest(url) { if (typeof url !== 'string') throw new Error(); return node_fetch_1.default(url) .then(res => res.json()) .catch((error) => { throw new Error('There was a problem with the fetch request'); }); } } exports.ClientRequest = ClientRequest;