Files
epg/scripts/core/api.js

20 lines
369 B
JavaScript
Raw Normal View History

2022-01-30 04:37:27 +03:00
const _ = require('lodash')
2022-01-30 04:02:29 +03:00
class API {
constructor(filepath) {
this.collection = require(filepath)
}
2022-01-30 04:37:27 +03:00
find(query) {
return _.find(this.collection, query)
2022-01-30 04:02:29 +03:00
}
}
const api = {}
api.channels = new API('../data/channels.json')
2022-01-30 04:37:27 +03:00
api.countries = new API('../data/countries.json')
api.subdivisions = new API('../data/subdivisions.json')
2022-01-30 04:02:29 +03:00
module.exports = api