Skip to content

Commit

Permalink
fix(notices): historical() note, type improvement, onceOnly text
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Sep 16, 2024
1 parent f1106c2 commit c131e5c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/lib/notices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,25 @@ type Notice = {
suppress?: boolean;
};

const notices = {
const notices: Record<string, Notice> = {
yahooSurvey: {
id: "yahooSurvey",
text:
"Please consider completing the survey at https://bit.ly/yahoo-finance-api-feedback " +
"if you haven't already; for more info see " +
"https://github.com/gadicc/node-yahoo-finance2/issues/764#issuecomment-2056623851.",
onceOnly: true,
} as Notice,
},
ripHistorical: {
id: "ripHistorical",
text:
"[Deprecated] historical() relies on an API that Yahoo have removed. We'll " +
"map this request to chart() for convenience, but, please consider using " +
"chart() directly instead; for more info see " +
"https://github.com/gadicc/node-yahoo-finance2/issues/795.",
level: "warn",
onceOnly: true,
},
};

export function showNotice(id: keyof typeof notices) {
Expand All @@ -29,8 +39,8 @@ export function showNotice(id: keyof typeof notices) {

const text =
n.text +
// (n.onceOnly ? " (only shown once)" : "") +
" You can supress this message in future with `yahooFinance.supressNotices(['" +
(n.onceOnly ? " This will only be shown once, but you" : "You") +
" can supress this message in future with `yahooFinance.supressNotices(['" +
id +
"'])`.";
const level = n.level || "info";
Expand Down

0 comments on commit c131e5c

Please sign in to comment.