Update db.js
This commit is contained in:
		| @@ -40,9 +40,13 @@ db.channels = { | |||||||
|     return this.list.filter(channel => channel.countries.map(c => c.code).includes(country.code)) |     return this.list.filter(channel => channel.countries.map(c => c.code).includes(country.code)) | ||||||
|   }, |   }, | ||||||
|   forLanguage(language) { |   forLanguage(language) { | ||||||
|  |     if (!language.code) return this.list.filter(channel => !channel.languages.length) | ||||||
|  |  | ||||||
|     return this.list.filter(channel => channel.languages.map(c => c.code).includes(language.code)) |     return this.list.filter(channel => channel.languages.map(c => c.code).includes(language.code)) | ||||||
|   }, |   }, | ||||||
|   forCategory(category) { |   forCategory(category) { | ||||||
|  |     if (!category.id) return this.list.filter(channel => !channel.category) | ||||||
|  |  | ||||||
|     return this.list.filter(channel => channel.category.toLowerCase() === category.id) |     return this.list.filter(channel => channel.category.toLowerCase() === category.id) | ||||||
|   }, |   }, | ||||||
|   count() { |   count() { | ||||||
| @@ -89,6 +93,11 @@ db.languages = { | |||||||
|   }, |   }, | ||||||
|   count() { |   count() { | ||||||
|     return this.list.length |     return this.list.length | ||||||
|  |   }, | ||||||
|  |   sortBy(fields) { | ||||||
|  |     this.list = utils.sortBy(this.list, fields) | ||||||
|  |  | ||||||
|  |     return this | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user