/
githubmirror
/
fullPage.js
Обзор
Документация
Войти
/
githubmirror
/
fullPage.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/js/common/getSectionByAnchor.js
14 строк
418 B
Alvaro Trigo López
- v4 version
16 мар 2022, 21:03
16 мар 2022, 21:03
902c448
Код
Авторство
О чём код?
import { getState } from "./state.js"; /** * Gets a section by its anchor / index */ export function getSectionByAnchor(sectionAnchor){ var section = getState().sections.filter(section => section.anchor === sectionAnchor)[0]; if(!section){ var sectionIndex = typeof sectionAnchor !== 'undefined' ? sectionAnchor -1 : 0; section = getState().sections[sectionIndex]; } return section; }