Skip to content

Commit

Permalink
fix(modules/*): filter out falsy elements (#6823)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanrastrick authored Jul 25, 2023
1 parent 5e88c4b commit e1b7254
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/modules/a11y/a11y.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ export default function A11y({ swiper, extendParams, on }) {
notification.innerHTML = message;
}

const makeElementsArray = (el) => {
if (!Array.isArray(el)) el = [el].filter((e) => !!e);
return el;
};
const makeElementsArray = el =>
(Array.isArray(el) ? el : [el]).filter((e) => !!e)

function getRandomNumber(size = 16) {
const randomChar = () => Math.round(16 * Math.random()).toString(16);
Expand Down
6 changes: 2 additions & 4 deletions src/modules/navigation/navigation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
prevEl: null,
};

const makeElementsArray = (el) => {
if (!Array.isArray(el)) el = [el].filter((e) => !!e);
return el;
};
const makeElementsArray = el =>
(Array.isArray(el) ? el : [el]).filter((e) => !!e)

function getEl(el) {
let res;
Expand Down
6 changes: 2 additions & 4 deletions src/modules/pagination/pagination.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ export default function Pagination({ swiper, extendParams, on, emit }) {
let bulletSize;
let dynamicBulletIndex = 0;

const makeElementsArray = (el) => {
if (!Array.isArray(el)) el = [el].filter((e) => !!e);
return el;
};
const makeElementsArray = el =>
(Array.isArray(el) ? el : [el]).filter((e) => !!e)

function isPaginationDisabled() {
return (
Expand Down

0 comments on commit e1b7254

Please sign in to comment.