Refactor object types to records

This commit is contained in:
Kasper Seweryn 2022-04-30 20:20:41 +02:00 committed by Georg Krause
parent 51435d0742
commit 7fb5284d0e
2 changed files with 3 additions and 3 deletions

View File

@ -116,9 +116,9 @@ export function humanSize (bytes: number) {
}
// Removes duplicates from a list
export function unique (list: { [key: string]: unknown }[], property: string) {
export function unique (list: Record<string, unknown>[], property: string) {
property = property || 'id'
const unique: { [key: string]: unknown }[] = []
const unique: Record<string, unknown>[] = []
list.map(x => unique.filter(a => a[property] === x[property]).length > 0 ? null : unique.push(x))
return unique
}

View File

@ -3,7 +3,7 @@ import { Store } from 'vuex'
import { Router } from 'vue-router'
import { APIErrorResponse } from '~/types'
export function setUpdate (obj: object, statuses: { [key: string]: unknown }, value: unknown) {
export function setUpdate (obj: object, statuses: Record<string, unknown>, value: unknown) {
for (const key of Object.keys(obj)) {
statuses[key] = value
}