mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 18:40:05 -04:00
Created code2flag() function
This commit is contained in:
parent
b6bb0b2f14
commit
1e20a90b0d
1 changed files with 13 additions and 0 deletions
|
@ -12,6 +12,19 @@ const iso6393 = require('iso-639-3')
|
||||||
let cache = {}
|
let cache = {}
|
||||||
let helper = {}
|
let helper = {}
|
||||||
|
|
||||||
|
helper.code2flag = function (code) {
|
||||||
|
switch (code) {
|
||||||
|
case 'uk':
|
||||||
|
return '🇬🇧'
|
||||||
|
case 'int':
|
||||||
|
return '🌎'
|
||||||
|
default:
|
||||||
|
return code
|
||||||
|
.toUpperCase()
|
||||||
|
.replace(/./g, char => String.fromCodePoint(char.charCodeAt(0) + 127397))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
helper.sortBy = function (arr, fields) {
|
helper.sortBy = function (arr, fields) {
|
||||||
return arr.sort((a, b) => {
|
return arr.sort((a, b) => {
|
||||||
for (let field of fields) {
|
for (let field of fields) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue