@vdegenne/cmc 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/data/all.json +1 -1
- package/data/mini.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -19,11 +19,16 @@ Create static data from CoinMarketCap :
|
|
|
19
19
|
## How to use data
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/* cmc.ts */
|
|
24
23
|
import _currencies from '@vdegenne/cmc/data/mini.json?inline' with {type: 'json'}
|
|
24
|
+
export * from '@vdegenne/cmc'
|
|
25
25
|
|
|
26
26
|
export const currencies = _currencies as unknown as CMC.MiniCurrency[]
|
|
27
|
+
|
|
28
|
+
export function getCMCCurrencyFromSymbol(symbol: string) {
|
|
29
|
+
symbol = symbol.toLocaleUpperCase()
|
|
30
|
+
return currencies.find((c) => symbol === c.symbol)
|
|
31
|
+
}
|
|
27
32
|
```
|
|
28
33
|
|
|
29
34
|
Do not forget to add `@vdegenne/cmc` to the list of `types` in your `tsconfig.json`.
|