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

yahoo-finance2

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yahoo-finance2 - npm Package Compare versions

Comparing version 1.13.0 to 1.13.1

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## [1.13.1](https://github.com/gadicc/node-yahoo-finance2/compare/v1.13.0...v1.13.1) (2021-06-14)
### Bug Fixes
* **csv2json:** recognize "null" -> null ([d077680](https://github.com/gadicc/node-yahoo-finance2/commit/d077680711ae22fd073e1684930b4605d15bd518))
* **historical:** skip null rows ([e98e51e](https://github.com/gadicc/node-yahoo-finance2/commit/e98e51e47b39e80d5e404849f7193e068e0a49fc))
# [1.13.0](https://github.com/gadicc/node-yahoo-finance2/compare/v1.12.1...v1.13.0) (2021-06-06)

@@ -2,0 +10,0 @@

12

dist/cjs/package.json
{
"name": "yahoo-finance2",
"version": "1.13.0",
"version": "1.13.1",
"description": "JS API for Yahoo Finance",

@@ -71,8 +71,8 @@ "type:": "commonjs",

"@semantic-release/npm": "7.1.3",
"@semantic-release/release-notes-generator": "9.0.2",
"@tsconfig/node12": "1.0.7",
"@semantic-release/release-notes-generator": "9.0.3",
"@tsconfig/node12": "1.0.8",
"@types/jest": "26.0.23",
"@types/node-fetch": "2.5.10",
"@typescript-eslint/eslint-plugin": "4.26.0",
"@typescript-eslint/parser": "4.26.0",
"@typescript-eslint/eslint-plugin": "4.26.1",
"@typescript-eslint/parser": "4.26.1",
"eslint": "7.28.0",

@@ -86,3 +86,3 @@ "eslint-config-prettier": "8.3.0",

"semantic-release": "17.4.3",
"ts-jest": "27.0.2",
"ts-jest": "27.0.3",
"ts-json-schema-generator": "0.93.0",

@@ -89,0 +89,0 @@ "ts-node": "9.1.1",

module.exports = {
"name": "yahoo-finance2",
"version": "1.13.0",
"version": "1.13.1",
"description": "JS API for Yahoo Finance",

@@ -71,8 +71,8 @@ "type:": "commonjs",

"@semantic-release/npm": "7.1.3",
"@semantic-release/release-notes-generator": "9.0.2",
"@tsconfig/node12": "1.0.7",
"@semantic-release/release-notes-generator": "9.0.3",
"@tsconfig/node12": "1.0.8",
"@types/jest": "26.0.23",
"@types/node-fetch": "2.5.10",
"@typescript-eslint/eslint-plugin": "4.26.0",
"@typescript-eslint/parser": "4.26.0",
"@typescript-eslint/eslint-plugin": "4.26.1",
"@typescript-eslint/parser": "4.26.1",
"eslint": "7.28.0",

@@ -86,3 +86,3 @@ "eslint-config-prettier": "8.3.0",

"semantic-release": "17.4.3",
"ts-jest": "27.0.2",
"ts-jest": "27.0.3",
"ts-json-schema-generator": "0.93.0",

@@ -89,0 +89,0 @@ "ts-node": "9.1.1",

@@ -18,2 +18,4 @@ "use strict";

return parseFloat(input);
if (input === "null")
return null;
return input;

@@ -20,0 +22,0 @@ }

@@ -21,3 +21,3 @@ "use strict";

const dates = ["period1", "period2"];
for (let fieldName of dates) {
for (const fieldName of dates) {
const value = queryOptions[fieldName];

@@ -35,2 +35,38 @@ if (value instanceof Date)

schemaKey: "#/definitions/HistoricalResult",
transformWith(result) {
const filteredResults = [];
const fieldCount = Object.keys(result[0]).length;
// Count number of null values in object (1-level deep)
function nullFieldCount(object) {
let nullCount = 0;
for (const val of Object.values(object))
if (val === null)
nullCount++;
return nullCount;
}
for (const row of result) {
const nullCount = nullFieldCount(row);
if (nullCount === 0) {
// No nulls is a legit (regular) result
filteredResults.push(row);
}
else if (nullCount !== fieldCount - 1 /* skip "date" */) {
// Unhandled case: some but not all values are null.
// Note: no need to check for null "date", validation does it for us
console.error(nullCount, row);
throw new Error("Historical returned a result with SOME (but not " +
"all) null values. Please report this, and provide the " +
"query that caused it.");
}
else {
// All fields (except "date") are null: silently skip (no-op)
}
}
/*
* We may consider, for future optimization, to count rows and create
* new array in advance, and skip consecutive blocks of null results.
* Of doubtful utility.
*/
return filteredResults;
},
},

@@ -37,0 +73,0 @@ moduleOptions,

{
"name": "yahoo-finance2",
"version": "1.13.0",
"version": "1.13.1",
"description": "JS API for Yahoo Finance",

@@ -71,8 +71,8 @@ "type": "module",

"@semantic-release/npm": "7.1.3",
"@semantic-release/release-notes-generator": "9.0.2",
"@tsconfig/node12": "1.0.7",
"@semantic-release/release-notes-generator": "9.0.3",
"@tsconfig/node12": "1.0.8",
"@types/jest": "26.0.23",
"@types/node-fetch": "2.5.10",
"@typescript-eslint/eslint-plugin": "4.26.0",
"@typescript-eslint/parser": "4.26.0",
"@typescript-eslint/eslint-plugin": "4.26.1",
"@typescript-eslint/parser": "4.26.1",
"eslint": "7.28.0",

@@ -86,3 +86,3 @@ "eslint-config-prettier": "8.3.0",

"semantic-release": "17.4.3",
"ts-jest": "27.0.2",
"ts-jest": "27.0.3",
"ts-json-schema-generator": "0.93.0",

@@ -89,0 +89,0 @@ "ts-node": "9.1.1",

export default {
"name": "yahoo-finance2",
"version": "1.13.0",
"version": "1.13.1",
"description": "JS API for Yahoo Finance",

@@ -71,8 +71,8 @@ "type": "module",

"@semantic-release/npm": "7.1.3",
"@semantic-release/release-notes-generator": "9.0.2",
"@tsconfig/node12": "1.0.7",
"@semantic-release/release-notes-generator": "9.0.3",
"@tsconfig/node12": "1.0.8",
"@types/jest": "26.0.23",
"@types/node-fetch": "2.5.10",
"@typescript-eslint/eslint-plugin": "4.26.0",
"@typescript-eslint/parser": "4.26.0",
"@typescript-eslint/eslint-plugin": "4.26.1",
"@typescript-eslint/parser": "4.26.1",
"eslint": "7.28.0",

@@ -86,3 +86,3 @@ "eslint-config-prettier": "8.3.0",

"semantic-release": "17.4.3",
"ts-jest": "27.0.2",
"ts-jest": "27.0.3",
"ts-json-schema-generator": "0.93.0",

@@ -89,0 +89,0 @@ "ts-node": "9.1.1",

@@ -16,2 +16,4 @@ // Partial implementation that covers everything we need

return parseFloat(input);
if (input === "null")
return null;
return input;

@@ -18,0 +20,0 @@ }

@@ -19,3 +19,3 @@ const queryOptionsDefaults = {

const dates = ["period1", "period2"];
for (let fieldName of dates) {
for (const fieldName of dates) {
const value = queryOptions[fieldName];

@@ -33,2 +33,38 @@ if (value instanceof Date)

schemaKey: "#/definitions/HistoricalResult",
transformWith(result) {
const filteredResults = [];
const fieldCount = Object.keys(result[0]).length;
// Count number of null values in object (1-level deep)
function nullFieldCount(object) {
let nullCount = 0;
for (const val of Object.values(object))
if (val === null)
nullCount++;
return nullCount;
}
for (const row of result) {
const nullCount = nullFieldCount(row);
if (nullCount === 0) {
// No nulls is a legit (regular) result
filteredResults.push(row);
}
else if (nullCount !== fieldCount - 1 /* skip "date" */) {
// Unhandled case: some but not all values are null.
// Note: no need to check for null "date", validation does it for us
console.error(nullCount, row);
throw new Error("Historical returned a result with SOME (but not " +
"all) null values. Please report this, and provide the " +
"query that caused it.");
}
else {
// All fields (except "date") are null: silently skip (no-op)
}
}
/*
* We may consider, for future optimization, to count rows and create
* new array in advance, and skip consecutive blocks of null results.
* Of doubtful utility.
*/
return filteredResults;
},
},

@@ -35,0 +71,0 @@ moduleOptions,

{
"name": "yahoo-finance2",
"version": "1.13.0",
"version": "1.13.1",
"description": "JS API for Yahoo Finance",

@@ -71,8 +71,8 @@ "type": "module",

"@semantic-release/npm": "7.1.3",
"@semantic-release/release-notes-generator": "9.0.2",
"@tsconfig/node12": "1.0.7",
"@semantic-release/release-notes-generator": "9.0.3",
"@tsconfig/node12": "1.0.8",
"@types/jest": "26.0.23",
"@types/node-fetch": "2.5.10",
"@typescript-eslint/eslint-plugin": "4.26.0",
"@typescript-eslint/parser": "4.26.0",
"@typescript-eslint/eslint-plugin": "4.26.1",
"@typescript-eslint/parser": "4.26.1",
"eslint": "7.28.0",

@@ -86,3 +86,3 @@ "eslint-config-prettier": "8.3.0",

"semantic-release": "17.4.3",
"ts-jest": "27.0.2",
"ts-jest": "27.0.3",
"ts-json-schema-generator": "0.93.0",

@@ -89,0 +89,0 @@ "ts-node": "9.1.1",

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