Skip to content

Commit

Permalink
chore(files_sharing): replace reduce() by flat()
Browse files Browse the repository at this point in the history
flat() is speaking

Support is good: https://caniuse.com/array-flat

Refs: nextcloud#48925

Signed-off-by: Thomas Lehmann <[email protected]>
  • Loading branch information
thlehmann-ionos committed Dec 6, 2024
1 parent e623446 commit 4ac858c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ export default {
// Add external results from the OCA.Sharing.ShareSearch api
const externalResults = this.externalResults.filter(result => !result.condition || result.condition(this))

// flatten array of arrays
const rawRecommendations = Object.values(request.data.ocs.data.exact)
.reduce((arr, elem) => arr.concat(elem), [])
const rawRecommendations = Object.values(request.data.ocs.data.exact).flat()

// remove invalid data and format to user-select layout
this.recommendations = this.filterOutExistingShares(rawRecommendations)
Expand Down

0 comments on commit 4ac858c

Please sign in to comment.