secst
Version:
SECST is a semantic, extensible, computational, styleable tagged markup language. You can use it to joyfully create compelling, interactive documents backed by HTML.
19 lines (17 loc) • 529 B
JavaScript
const getTagsByName = function(node,tagName,results=[]) {
if(node.content) {
node.content.reduce((results,item) => {
if(item.tag===tagName) {
results.push(item)
}
if(item.content) {
item.content.forEach((node) => {
getTagsByName(node,tagName,results);
})
}
return results;
},results)
}
return results;
};
export {getTagsByName, getTagsByName as default}