({
files,
accept,
minSize,
maxSize,
multiple,
maxFiles,
validator,
})
| 128 | * @returns |
| 129 | */ |
| 130 | export function allFilesAccepted({ |
| 131 | files, |
| 132 | accept, |
| 133 | minSize, |
| 134 | maxSize, |
| 135 | multiple, |
| 136 | maxFiles, |
| 137 | validator, |
| 138 | }) { |
| 139 | if ( |
| 140 | (!multiple && files.length > 1) || |
| 141 | (multiple && maxFiles >= 1 && files.length > maxFiles) |
| 142 | ) { |
| 143 | return false; |
| 144 | } |
| 145 | |
| 146 | return files.every((file) => { |
| 147 | const [accepted] = fileAccepted(file, accept); |
| 148 | const [sizeMatch] = fileMatchSize(file, minSize, maxSize); |
| 149 | const customErrors = validator ? validator(file) : null; |
| 150 | return accepted && sizeMatch && !customErrors; |
| 151 | }); |
| 152 | } |
| 153 | |
| 154 | // React's synthetic events has event.isPropagationStopped, |
| 155 | // but to remain compatibility with other libs (Preact) fall back |
no test coverage detected
searching dependent graphs…