mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 14:49:58 -07:00
website: snapshot
This commit is contained in:
23
website/scripts/options/utils.js
Normal file
23
website/scripts/options/utils.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/** Market utilities */
|
||||
|
||||
/**
|
||||
* Convert period ID to readable name
|
||||
* @param {string} id
|
||||
* @param {boolean} [compoundAdjective]
|
||||
*/
|
||||
export function periodIdToName(id, compoundAdjective) {
|
||||
const num = parseInt(id);
|
||||
const s = compoundAdjective || num === 1 ? "" : "s";
|
||||
switch (id.slice(-1)) {
|
||||
case "d":
|
||||
return `${num} day${s}`;
|
||||
case "w":
|
||||
return `${num} week${s}`;
|
||||
case "m":
|
||||
return `${num} month${s}`;
|
||||
case "y":
|
||||
return `${num} year${s}`;
|
||||
default:
|
||||
return id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user