Update update-readme.js

This commit is contained in:
Aleksandr Statciuk 2022-01-30 04:37:27 +03:00
parent da23d7e267
commit 3793895948
3 changed files with 14 additions and 10 deletions

View file

@ -1,15 +1,19 @@
const _ = require('lodash')
class API {
constructor(filepath) {
this.collection = require(filepath)
}
get(id) {
return this.collection.find(c => c.id === id)
find(query) {
return _.find(this.collection, query)
}
}
const api = {}
api.channels = new API('../data/channels.json')
api.countries = new API('../data/countries.json')
api.subdivisions = new API('../data/subdivisions.json')
module.exports = api