Luke Childs
7 years ago
commit
fdff391a70
9 changed files with 9606 additions and 0 deletions
@ -0,0 +1,76 @@ |
|||||
|
## Node |
||||
|
|
||||
|
# Lockfiles |
||||
|
yarn.lock |
||||
|
package-lock.json |
||||
|
|
||||
|
# Logs |
||||
|
logs |
||||
|
*.log |
||||
|
npm-debug.log* |
||||
|
|
||||
|
# Runtime data |
||||
|
pids |
||||
|
*.pid |
||||
|
*.seed |
||||
|
*.pid.lock |
||||
|
|
||||
|
# Directory for instrumented libs generated by jscoverage/JSCover |
||||
|
lib-cov |
||||
|
|
||||
|
# Coverage directory used by tools like istanbul |
||||
|
coverage |
||||
|
|
||||
|
# nyc test coverage |
||||
|
.nyc_output |
||||
|
|
||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) |
||||
|
.grunt |
||||
|
|
||||
|
# node-waf configuration |
||||
|
.lock-wscript |
||||
|
|
||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html) |
||||
|
build/Release |
||||
|
|
||||
|
# Dependency directories |
||||
|
node_modules |
||||
|
jspm_packages |
||||
|
|
||||
|
# Optional npm cache directory |
||||
|
.npm |
||||
|
|
||||
|
# Optional eslint cache |
||||
|
.eslintcache |
||||
|
|
||||
|
# Optional REPL history |
||||
|
.node_repl_history |
||||
|
|
||||
|
## OS X |
||||
|
|
||||
|
*.DS_Store |
||||
|
.AppleDouble |
||||
|
.LSOverride |
||||
|
|
||||
|
# Icon must end with two \r |
||||
|
Icon |
||||
|
|
||||
|
|
||||
|
# Thumbnails |
||||
|
._* |
||||
|
|
||||
|
# Files that might appear in the root of a volume |
||||
|
.DocumentRevisions-V100 |
||||
|
.fseventsd |
||||
|
.Spotlight-V100 |
||||
|
.TemporaryItems |
||||
|
.Trashes |
||||
|
.VolumeIcon.icns |
||||
|
.com.apple.timemachine.donotpresent |
||||
|
|
||||
|
# Directories potentially created on remote AFP share |
||||
|
.AppleDB |
||||
|
.AppleDesktop |
||||
|
Network Trash Folder |
||||
|
Temporary Items |
||||
|
.apdisk |
@ -0,0 +1,6 @@ |
|||||
|
language: node_js |
||||
|
script: npm test |
||||
|
after_success: npm run coverage |
||||
|
notifications: |
||||
|
email: |
||||
|
on_success: never |
@ -0,0 +1,21 @@ |
|||||
|
MIT License |
||||
|
|
||||
|
Copyright (c) 2018 Luke Childs |
||||
|
|
||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
|
of this software and associated documentation files (the "Software"), to deal |
||||
|
in the Software without restriction, including without limitation the rights |
||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
|
copies of the Software, and to permit persons to whom the Software is |
||||
|
furnished to do so, subject to the following conditions: |
||||
|
|
||||
|
The above copyright notice and this permission notice shall be included in all |
||||
|
copies or substantial portions of the Software. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
|
SOFTWARE. |
@ -0,0 +1,25 @@ |
|||||
|
# coinlist |
||||
|
|
||||
|
> Comprehensive list of cryptocurrencies with metadata |
||||
|
|
||||
|
[![Build Status](https://travis-ci.org/lukechilds/coinlist.svg?branch=master)](https://travis-ci.org/lukechilds/coinlist) |
||||
|
[![Coverage Status](https://coveralls.io/repos/github/lukechilds/coinlist/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/coinlist?branch=master) |
||||
|
[![npm](https://img.shields.io/npm/v/coinlist.svg)](https://www.npmjs.com/package/coinlist) |
||||
|
|
||||
|
List compiled from the coinmarketcap.com API. Importable as a raw JSON file or an array with helper methods. |
||||
|
|
||||
|
## Install |
||||
|
|
||||
|
```shell |
||||
|
yarn add coinlist |
||||
|
``` |
||||
|
|
||||
|
## Usage |
||||
|
|
||||
|
```js |
||||
|
// TODO |
||||
|
``` |
||||
|
|
||||
|
## License |
||||
|
|
||||
|
MIT © Luke Childs |
@ -0,0 +1,21 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const got = require('got'); |
||||
|
const writeJsonFile = require('write-json-file'); |
||||
|
|
||||
|
const jsonFile = 'src/coins.json'; |
||||
|
|
||||
|
(async () => { |
||||
|
console.log(`Fetching data...`); |
||||
|
const response = await got('https://api.coinmarketcap.com/v1/ticker/?limit=0', { json: true }); |
||||
|
const coins = response.body |
||||
|
.map(coin => ({ |
||||
|
id: coin.id, |
||||
|
symbol: coin.symbol, |
||||
|
name: coin.name, |
||||
|
maxSupply: parseFloat(coin.max_supply) |
||||
|
})) |
||||
|
.sort((a, b) => a.id.localeCompare(b.id)); |
||||
|
await writeJsonFile(jsonFile, coins); |
||||
|
console.log(`Written ${coins.length} coins to ${jsonFile}`); |
||||
|
})(); |
@ -0,0 +1,40 @@ |
|||||
|
{ |
||||
|
"name": "coinlist", |
||||
|
"version": "0.0.0", |
||||
|
"description": "Comprehensive list of cryptocurrencies with metadata", |
||||
|
"main": "src/index.js", |
||||
|
"scripts": { |
||||
|
"build": "node ./build", |
||||
|
"test": "xo && nyc ava", |
||||
|
"coverage": "nyc report --reporter=text-lcov | coveralls" |
||||
|
}, |
||||
|
"xo": { |
||||
|
"extends": "xo-lukechilds" |
||||
|
}, |
||||
|
"repository": { |
||||
|
"type": "git", |
||||
|
"url": "git+https://github.com/lukechilds/coinlist.git" |
||||
|
}, |
||||
|
"keywords": [ |
||||
|
"crypto", |
||||
|
"cryptocurrencies", |
||||
|
"cryptocoins", |
||||
|
"list" |
||||
|
], |
||||
|
"author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)", |
||||
|
"license": "MIT", |
||||
|
"bugs": { |
||||
|
"url": "https://github.com/lukechilds/coinlist/issues" |
||||
|
}, |
||||
|
"homepage": "https://github.com/lukechilds/coinlist", |
||||
|
"dependencies": {}, |
||||
|
"devDependencies": { |
||||
|
"ava": "^0.25.0", |
||||
|
"coveralls": "^3.0.0", |
||||
|
"eslint-config-xo-lukechilds": "^1.0.0", |
||||
|
"got": "^8.3.0", |
||||
|
"nyc": "^11.0.2", |
||||
|
"write-json-file": "^2.3.0", |
||||
|
"xo": "^0.19.0" |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,7 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const coins = require('./coins.json'); |
||||
|
|
||||
|
coins.get = symbol => coins.find(coin => coin.symbol.toUpperCase() === symbol.toUpperCase()); |
||||
|
|
||||
|
module.exports = coins; |
@ -0,0 +1,6 @@ |
|||||
|
import test from 'ava'; |
||||
|
import coins from '../'; |
||||
|
|
||||
|
test('coins is an array', t => { |
||||
|
t.true(Array.isArray(coins)); |
||||
|
}); |
Loading…
Reference in new issue