mirror of
https://github.com/em-squared/5e-drs.git
synced 2025-10-30 13:14:20 +00:00
modification de l'identification des resources plus robuste
This commit is contained in:
parent
0494298159
commit
96d028dfa6
14 changed files with 130 additions and 94 deletions
|
|
@ -238,3 +238,27 @@ function resolveItem (item, pages, base, groupDepth = 1) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Returns index of resource in library
|
||||
*/
|
||||
export function getResourceIndexInLibrary (resource, library) {
|
||||
let idx = -1
|
||||
if (resource.custom) {
|
||||
idx = library.findIndex(item => item.key == resource.key)
|
||||
} else {
|
||||
idx = library.findIndex(item => item.path == resource.path)
|
||||
}
|
||||
return idx
|
||||
}
|
||||
|
||||
/*
|
||||
** Returns presence of resource in library
|
||||
*/
|
||||
export function isResourceInLibrary (resource, library) {
|
||||
let idx = getResourceIndexInLibrary(resource, library)
|
||||
if (idx >= 0) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue