-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from ozgurg/ts-support
release: v3.2.0
- Loading branch information
Showing
7 changed files
with
1,560 additions
and
1,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default googleCurrencyScraper; | ||
export { CurrencyCode }; | ||
import googleCurrencyScraper from "./src/google-currency-scraper.js"; | ||
import { CurrencyCode } from "./src/utils/currency-code.js"; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "google-currency-scraper", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Scrape extremely up-to-date exchange rates from Google fast and for free, with only one external dependency.", | ||
"license": "MIT", | ||
"type": "module", | ||
|
@@ -14,7 +14,8 @@ | |
"lint:fix": "npm run lint -- --fix", | ||
"lint": "eslint --ext .js .", | ||
"lint-staged": "lint-staged", | ||
"prepare": "husky" | ||
"prepare": "husky", | ||
"generate-types": "tsc" | ||
}, | ||
"author": { | ||
"email": "[email protected]", | ||
|
@@ -39,12 +40,13 @@ | |
"cheerio": "1.0.0-rc.12" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "19.0.3", | ||
"@commitlint/config-conventional": "19.0.3", | ||
"@commitlint/cli": "19.3.0", | ||
"@commitlint/config-conventional": "19.2.2", | ||
"eslint": "8.57.0", | ||
"eslint-config-google": "0.14.0", | ||
"husky": "9.0.11", | ||
"lint-staged": "15.2.2", | ||
"vitest": "1.3.1" | ||
"lint-staged": "15.2.7", | ||
"typescript": "5.5.3", | ||
"vitest": "2.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default googleCurrencyScraper; | ||
/** | ||
* @param {object} params | ||
* @param {CurrencyCode | string} params.from | ||
* @param {CurrencyCode | string} params.to | ||
* @returns {Promise<{from: CurrencyCode | string, to: CurrencyCode | string, rate: number, dateUpdated: string}>} | ||
*/ | ||
declare function googleCurrencyScraper({ from, to }: { | ||
from: CurrencyCode | string; | ||
to: CurrencyCode | string; | ||
}): Promise<{ | ||
from: CurrencyCode | string; | ||
to: CurrencyCode | string; | ||
rate: number; | ||
dateUpdated: string; | ||
}>; | ||
import { CurrencyCode } from "./utils/currency-code.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
export type CurrencyCode = { | ||
[x: string]: string; | ||
}; | ||
export namespace CurrencyCode { | ||
let AED: string; | ||
let AFN: string; | ||
let ALL: string; | ||
let AMD: string; | ||
let ANG: string; | ||
let AOA: string; | ||
let ARS: string; | ||
let AUD: string; | ||
let AWG: string; | ||
let AZN: string; | ||
let BAM: string; | ||
let BBD: string; | ||
let BDT: string; | ||
let BGN: string; | ||
let BHD: string; | ||
let BIF: string; | ||
let BMD: string; | ||
let BND: string; | ||
let BOB: string; | ||
let BOV: string; | ||
let BRL: string; | ||
let BSD: string; | ||
let BTN: string; | ||
let BWP: string; | ||
let BYN: string; | ||
let BZD: string; | ||
let CAD: string; | ||
let CDF: string; | ||
let CHE: string; | ||
let CHF: string; | ||
let CHW: string; | ||
let CLF: string; | ||
let CLP: string; | ||
let COP: string; | ||
let COU: string; | ||
let CRC: string; | ||
let CUC: string; | ||
let CUP: string; | ||
let CVE: string; | ||
let CZK: string; | ||
let DJF: string; | ||
let DKK: string; | ||
let DOP: string; | ||
let DZD: string; | ||
let EGP: string; | ||
let ERN: string; | ||
let ETB: string; | ||
let EUR: string; | ||
let FJD: string; | ||
let FKP: string; | ||
let GBP: string; | ||
let GEL: string; | ||
let GHS: string; | ||
let GIP: string; | ||
let GMD: string; | ||
let GNF: string; | ||
let GTQ: string; | ||
let GYD: string; | ||
let HKD: string; | ||
let HNL: string; | ||
let HRK: string; | ||
let HTG: string; | ||
let HUF: string; | ||
let IDR: string; | ||
let ILS: string; | ||
let INR: string; | ||
let IQD: string; | ||
let IRR: string; | ||
let ISK: string; | ||
let JMD: string; | ||
let JOD: string; | ||
let JPY: string; | ||
let KES: string; | ||
let KGS: string; | ||
let KHR: string; | ||
let KMF: string; | ||
let KPW: string; | ||
let KRW: string; | ||
let KWD: string; | ||
let KYD: string; | ||
let KZT: string; | ||
let LAK: string; | ||
let LBP: string; | ||
let LKR: string; | ||
let LRD: string; | ||
let LSL: string; | ||
let LYD: string; | ||
let MAD: string; | ||
let MDL: string; | ||
let MGA: string; | ||
let MKD: string; | ||
let MMK: string; | ||
let MNT: string; | ||
let MOP: string; | ||
let MRU: string; | ||
let MUR: string; | ||
let MVR: string; | ||
let MWK: string; | ||
let MXN: string; | ||
let MXV: string; | ||
let MYR: string; | ||
let MZN: string; | ||
let NAD: string; | ||
let NGN: string; | ||
let NIO: string; | ||
let NOK: string; | ||
let NPR: string; | ||
let NZD: string; | ||
let OMR: string; | ||
let PAB: string; | ||
let PEN: string; | ||
let PGK: string; | ||
let PHP: string; | ||
let PKR: string; | ||
let PLN: string; | ||
let PYG: string; | ||
let QAR: string; | ||
let RON: string; | ||
let RSD: string; | ||
let CNY: string; | ||
let RUB: string; | ||
let RWF: string; | ||
let SAR: string; | ||
let SBD: string; | ||
let SCR: string; | ||
let SDG: string; | ||
let SEK: string; | ||
let SGD: string; | ||
let SHP: string; | ||
let SLL: string; | ||
let SOS: string; | ||
let SRD: string; | ||
let SSP: string; | ||
let STN: string; | ||
let SVC: string; | ||
let SYP: string; | ||
let SZL: string; | ||
let THB: string; | ||
let TJS: string; | ||
let TMT: string; | ||
let TND: string; | ||
let TOP: string; | ||
let TRY: string; | ||
let TTD: string; | ||
let TWD: string; | ||
let TZS: string; | ||
let UAH: string; | ||
let UGX: string; | ||
let USD: string; | ||
let USN: string; | ||
let UYI: string; | ||
let UYU: string; | ||
let UYW: string; | ||
let UZS: string; | ||
let VED: string; | ||
let VES: string; | ||
let VND: string; | ||
let VUV: string; | ||
let WST: string; | ||
let XAF: string; | ||
let XAG: string; | ||
let XAU: string; | ||
let XBA: string; | ||
let XBB: string; | ||
let XBC: string; | ||
let XBD: string; | ||
let XCD: string; | ||
let XDR: string; | ||
let XOF: string; | ||
let XPD: string; | ||
let XPF: string; | ||
let XPT: string; | ||
let XSU: string; | ||
let XTS: string; | ||
let XUA: string; | ||
let XXX: string; | ||
let YER: string; | ||
let ZAR: string; | ||
let ZMW: string; | ||
let ZWL: string; | ||
let BDS: string; | ||
let CNH: string; | ||
let CNT: string; | ||
let GGP: string; | ||
let IMP: string; | ||
let JEP: string; | ||
let KID: string; | ||
let NIS: string; | ||
let NTD: string; | ||
let PRB: string; | ||
let SLS: string; | ||
let STG: string; | ||
let RMB: string; | ||
let TVD: string; | ||
let ZWB: string; | ||
} | ||
/** | ||
* @param {CurrencyCode | string} code | ||
* @return {boolean} | ||
*/ | ||
export function isValidCurrencyCode(code: CurrencyCode | string): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* @param {string} dateString | ||
* @return {string} | ||
*/ | ||
export function cleanDateInSearchResult(dateString: string): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"include": [ | ||
"**/*.js" | ||
], | ||
"exclude": [ | ||
"**/*.test.js" | ||
], | ||
"compilerOptions": { | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"allowJs": true | ||
} | ||
} |