api page coverSrc support; filter tags response by field

This commit is contained in:
tmshv committed 2020-03-03 07:43:30 +03:00
1 parent 11ff066e6c
commit 1318328fe7
4 files changed
+42 -10

No files matched your search

+14 -1
View File
@@ -1,4 +1,4 @@
export function unique<T>(items: T[], key: (item: T) => string): T[]{
export function unique<T>(items: T[], key: (item: T) => string): T[] {
const map = new Map(items.map(x => [key(x), x]))
return [...map.values()]
@@ -16,3 +16,16 @@ export function ensureArray<T>(value: T | T[]): T[] {
return [value]
}
/**
*
* Check if array has one item at least
*
* @param items
*/
export function isArrayOk<T>(items: T[]): boolean {
if (!Array.isArray(items)) {
return false
}
return items.length > 0
}