Simplify this a bit more

This commit is contained in:
shamoon 2024-09-23 10:46:20 -07:00
parent 1b7cacc877
commit f06ff85b7d
2 changed files with 3 additions and 9 deletions

View File

@ -8,7 +8,7 @@ describe('popperOptionsReenablePreventOverflow', () => {
{ name: 'preventOverflow', fn: function () {} },
{
name: 'preventOverflow',
fn: function () {
fn: function (arg0) {
return
},
},

View File

@ -3,15 +3,9 @@ import { Options } from '@popperjs/core'
export function popperOptionsReenablePreventOverflow(
config: Partial<Options>
): Partial<Options> {
const preventOverflowModifier = config.modifiers?.find(
(m) => m.name === 'preventOverflow' && m.fn?.length === 0
config.modifiers = config.modifiers?.filter(
(m) => !(m.name === 'preventOverflow' && m.fn?.length === 0)
)
if (preventOverflowModifier) {
config.modifiers.splice(
config.modifiers.indexOf(preventOverflowModifier),
1
)
}
const ogPreventOverflowModifier = config.modifiers.find(
(m) => m.name === 'preventOverflow'
)