mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-18 00:55:35 +00:00
@uppy/utils: remove ponyfill for Array#findIndex (#3080)
The built-in method is supported everywhere.
This commit is contained in:
parent
2c1287fc52
commit
9866fc1f5c
3 changed files with 3 additions and 12 deletions
|
|
@ -112,7 +112,7 @@ module.exports = class ProviderView {
|
|||
let updatedDirectories
|
||||
|
||||
const state = this.plugin.getPluginState()
|
||||
const index = findIndex(state.directories, (dir) => id === dir.id)
|
||||
const index = state.directories.findIndex((dir) => id === dir.id)
|
||||
|
||||
if (index !== -1) {
|
||||
updatedDirectories = state.directories.slice(0, index + 1)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
const findIndex = require('./findIndex')
|
||||
|
||||
function createCancelError () {
|
||||
return new Error('Cancelled')
|
||||
}
|
||||
|
|
@ -84,7 +82,7 @@ class RateLimitedQueue {
|
|||
},
|
||||
}
|
||||
|
||||
const index = findIndex(this.#queuedHandlers, (other) => {
|
||||
const index = this.#queuedHandlers.findIndex((other) => {
|
||||
return handler.priority > other.priority
|
||||
})
|
||||
if (index === -1) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,6 @@
|
|||
/**
|
||||
* Array.prototype.findIndex ponyfill for old browsers.
|
||||
*
|
||||
* @param {Array} array
|
||||
* @param {Function} predicate
|
||||
* @returns {number}
|
||||
*/
|
||||
module.exports = function findIndex (array, predicate) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
if (predicate(array[i])) return i
|
||||
}
|
||||
return -1
|
||||
}
|
||||
module.exports = Function.prototype.call.bind(Array.prototype.findIndex)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue