You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
More vue updates
This commit is contained in:
24
_assets/src/utils/array.js
Normal file
24
_assets/src/utils/array.js
Normal file
@@ -0,0 +1,24 @@
|
||||
// Removes an element, if exists, from an array
|
||||
function removeElement (array, element) {
|
||||
var i = array.indexOf(element)
|
||||
if (i !== -1) {
|
||||
array.splice(i, 1)
|
||||
}
|
||||
|
||||
return array
|
||||
}
|
||||
|
||||
// Replaces an element inside an array by another
|
||||
function replaceElement (array, oldElement, newElement) {
|
||||
var i = array.indexOf(oldElement)
|
||||
if (i !== -1) {
|
||||
array[i] = newElement
|
||||
}
|
||||
|
||||
return array
|
||||
}
|
||||
|
||||
export default {
|
||||
remove: removeElement,
|
||||
replace: replaceElement
|
||||
}
|
||||
Reference in New Issue
Block a user