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

stock-info

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stock-info - npm Package Compare versions

Comparing version 1.6.1 to 1.6.2

dist/index.cjs

47

dist/index.js

@@ -1,2 +0,45 @@

function r(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var e=/*#__PURE__*/r(require("axios")),t=function(r){return new Promise(function(t,n){if(!r)return n(Error("Stock symbol required"));if("string"!=typeof r)return n(Error("Invalid argument type. Required: string. Found: "+typeof r));var o="https://query1.finance.yahoo.com/v7/finance/quote?symbols="+r,i="undefined"!=typeof window?"https://thingproxy.freeboard.io/fetch/"+o:o;return e.default.get(i,{headers:{"Content-Type":"application/json"}}).then(function(e){var o=e.data;return o&&o.quoteResponse&&o.quoteResponse.result&&0!==o.quoteResponse.result.length?t(o.quoteResponse.result[0]):n(Error("Error retrieving info for symbol "+r))}).catch(function(r){return n(r)})})};exports.getSingleStockInfo=t,exports.getStocksInfo=function(r){return new Promise(function(e,n){if(!r)return n(Error("Stock symbol list required"));if(!Array.isArray(r))return n(Error("Invalid argument type. Array required."));var o=[].concat(r);if(!o.length||o.length<1)return Promise.resolve([]);var i=o.map(t);return e(Promise.all(i))})};
//# sourceMappingURL=index.js.map
function r(r) {
return r && typeof r === "object" && "default" in r ? r : { default: r };
}
const e = /* #__PURE__ */ r(require("axios"));
const t = function (r) {
return new Promise((t, n) => {
if (!r) return n(Error("Stock symbol required"));
if (typeof r !== "string")
return n(
Error(`Invalid argument type. Required: string. Found: ${typeof r}`)
);
const o = `https://query1.finance.yahoo.com/v7/finance/quote?symbols=${r}`;
const i =
typeof window !== "undefined"
? `https://thingproxy.freeboard.io/fetch/${o}`
: o;
return e.default
.get(i, { headers: { "Content-Type": "application/json" } })
.then((e) => {
const o = e.data;
return o &&
o.quoteResponse &&
o.quoteResponse.result &&
o.quoteResponse.result.length !== 0
? t(o.quoteResponse.result[0])
: n(Error(`Error retrieving info for symbol ${r}`));
})
.catch((r) => n(r));
});
};
(exports.getSingleStockInfo = t),
(exports.getStocksInfo = function (r) {
return new Promise((e, n) => {
if (!r) return n(Error("Stock symbol list required"));
if (!Array.isArray(r))
return n(Error("Invalid argument type. Array required."));
const o = [].concat(r);
if (!o.length || o.length < 1) return Promise.resolve([]);
const i = o.map(t);
return e(Promise.all(i));
});
});
// # sourceMappingURL=index.js.map

8

package.json
{
"name": "stock-info",
"version": "1.6.1",
"type": "module",
"version": "1.6.2",
"description": "Module to retrieve stock information from Yahoo Finance API",

@@ -42,3 +43,6 @@ "files": [

"source": "src/index.ts",
"exports": "./dist/index.modern.js",
"exports": {
"require": "./dist/index.cjs",
"default": "./dist/index.modern.js"
},
"main": "./dist/index.cjs",

@@ -45,0 +49,0 @@ "module": "./dist/index.module.js",

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