stock-info
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -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 |
{ | ||
"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", |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
32792
17
256
Yes