Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nomics

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nomics - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

8

dist/api/currencies_ticker.js

@@ -37,2 +37,5 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _this = this;

@@ -43,3 +46,4 @@ Object.defineProperty(exports, "__esModule", { value: true });

var fetch_1 = require("../utils/fetch");
var CURRENCIES_TICKER_URL = constants_1.API_BASE + "/v1/currencies/ticker";
var __1 = __importDefault(require(".."));
var CURRENCIES_TICKER_PATH = "/v1/currencies/ticker";
var currenciesTicker = function (key, options) {

@@ -56,3 +60,3 @@ if (options === void 0) { options = {}; }

};
return [2 /*return*/, fetch_1.fetchJSON(CURRENCIES_TICKER_URL + "?" + url_1.objToUrlParams(objParams))];
return [2 /*return*/, fetch_1.fetchJSON("" + __1.default.NOMICS_API_BASE + CURRENCIES_TICKER_PATH + "?" + url_1.objToUrlParams(objParams))];
});

@@ -59,0 +63,0 @@ });

@@ -15,2 +15,4 @@ import { ICurrenciesTickerOptions, IRawCurrencyTicker, CurrencyTickerInterval } from "./api/currencies_ticker";

private version;
private static baseUrl;
static NOMICS_API_BASE: string;
constructor(options: INomicsOptions);

@@ -17,0 +19,0 @@ currenciesTicker(options?: ICurrenciesTickerOptions): Promise<IRawCurrencyTicker[]>;

@@ -20,5 +20,16 @@ "use strict";

}
Object.defineProperty(Nomics, "NOMICS_API_BASE", {
get: function () {
return Nomics.baseUrl;
},
set: function (apiBase) {
Nomics.baseUrl = apiBase;
},
enumerable: true,
configurable: true
});
Nomics.prototype.currenciesTicker = function (options) {
return currencies_ticker_1.default(this.apiKey, options);
};
Nomics.baseUrl = constants_1.API_BASE;
return Nomics;

@@ -25,0 +36,0 @@ }());

{
"name": "nomics",
"version": "0.2.3",
"version": "0.2.4",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import currenciesTicker from "./currencies_ticker";
import { fetchJSON } from "../utils/fetch";
import { API_BASE } from "../constants";
import Nomics from "..";

@@ -34,1 +35,9 @@ jest.mock("../utils/fetch");

});
test("can change the base url via static property", () => {
Nomics.NOMICS_API_BASE = "http://test.nomics.com";
currenciesTicker("xyz", { interval: ["1d"] });
expect(fetchJSON).toHaveBeenCalledWith(
expect.stringContaining("http://test.nomics.com")
);
});

@@ -1,4 +0,5 @@

import { API_BASE, IntervalEnum } from "../constants";
import { IntervalEnum } from "../constants";
import { objToUrlParams } from "../utils/url";
import { fetchJSON } from "../utils/fetch";
import Nomics from "..";

@@ -44,3 +45,3 @@ export interface ICurrenciesTickerOptions {

const CURRENCIES_TICKER_URL = `${API_BASE}/v1/currencies/ticker`;
const CURRENCIES_TICKER_PATH = `/v1/currencies/ticker`;

@@ -58,5 +59,9 @@ const currenciesTicker = async (

return fetchJSON(`${CURRENCIES_TICKER_URL}?${objToUrlParams(objParams)}`);
return fetchJSON(
`${Nomics.NOMICS_API_BASE}${CURRENCIES_TICKER_PATH}?${objToUrlParams(
objParams
)}`
);
};
export default currenciesTicker;

@@ -6,3 +6,3 @@ import currenciesTicker, {

} from "./api/currencies_ticker";
import { IntervalEnum } from "./constants";
import { IntervalEnum, API_BASE } from "./constants";
import { isEmpty } from "./utils/str";

@@ -28,2 +28,12 @@

private static baseUrl: string = API_BASE;
public static set NOMICS_API_BASE(apiBase: string) {
Nomics.baseUrl = apiBase;
}
public static get NOMICS_API_BASE() {
return Nomics.baseUrl;
}
constructor(options: INomicsOptions) {

@@ -30,0 +40,0 @@ const { apiKey, version } = options;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc