/
lostSun
/
project-client-server-apps
Обзор
Документация
Войти
/
lostSun
/
project-client-server-apps
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/css-select-base-adapter/test/implementation.js
22 строки
611 B
1lostsun
initial commit
05 май 2025, 11:35
05 май 2025, 11:35
fe8f535
Код
Авторство
О чём код?
'use strict' const implementation = { isTag: node => node !== undefined && 'name' in node, getAttributeValue: ( elem, name ) => { if( implementation.isTag( elem ) && elem.attribs ) return elem.attribs[ name ] }, getChildren: node => node.children, getName: elem => { if( implementation.isTag( elem ) ) return elem.name }, getParent: node => node.parent, getText: node => node.children.map( child => { if( child.text ) return child.text if( implementation.isTag( child ) ) return implementation.getText( child ) return '' }).join( '' ) } module.exports = implementation