UNPKG

good-spatula

Version:

Light weight and reliable binding of htmlparser2, css-select and dom-serializer.

11 lines (8 loc) 250 B
const _ = require('lodash'); module.exports = (spatula, getDom) => (name) => { const dom = getDom(); if (_.isArray(dom)) { return dom.map(x => _.isNil(x.attribs) ? undefined : x.attribs[name]); } return dom.attribs[name]; }