Refactor object types to records
This commit is contained in:
parent
51435d0742
commit
7fb5284d0e
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue