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) • 501 B
JavaScript
const getTagById = function(node,id,results=[]) {
if(node.content) {
node.content.reduce((results,item) => {
if(item.id===id) {
results.push(item)
}
if(item.content) {
item.content.forEach((node) => {
getTagById(node,id,results);
})
}
return results;
},results)
}
return results;
};
export {getTagById, getTagById as default}