/
vasya2
/
var
Обзор
Документация
Войти
/
vasya2
/
var
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tools/challenge-parser/parser/plugins/utils/before-heading.js
21 строка
467 B
Tom
feat(challenge-parser): add feedback to mc questions (#51942)
02 ноя 2023, 09:28
Не верифицирован
02 ноя 2023, 09:28
bce1b99
Код
Авторство
О чём код?
const find = require('unist-util-find'); const findAllBefore = require('unist-util-find-all-before'); function getAllBefore(tree, marker) { const start = find(tree, { type: 'heading', children: [ { type: 'text', value: marker } ] }); if (!start) return []; // reverse because it goes up the tree backwards and adds nodes in that order return findAllBefore(tree, start).reverse(); } module.exports = getAllBefore;