mirror of
https://github.com/iptv-org/iptv
synced 2026-11-04 08:14:28 -05:00
Create scripts/store/setters
This commit is contained in:
1 parent
df6af6dec0
commit
7255ab8335
13 files changed
+156
No files matched your search
@@ -0,0 +1,22 @@
|
||||
const _ = require('lodash')
|
||||
|
||||
let regions = require('../../data/regions')
|
||||
|
||||
module.exports = function ({ countries }) {
|
||||
if (!countries.length) return []
|
||||
|
||||
const output = []
|
||||
regions = Object.values(regions)
|
||||
countries.forEach(country => {
|
||||
regions
|
||||
.filter(region => region.country_codes.includes(country.code))
|
||||
.forEach(found => {
|
||||
output.push({
|
||||
name: found.name,
|
||||
code: found.code
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
return _.uniqBy(output, 'code')
|
||||
}
|
||||
Reference in new issue
Block a user