Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (dom, config) {
config = config || {};
// resolve the base url of the document
var base = config.base || '';
var baseElem = DOM.findOne(function (elem) {
return elem.name === 'base' && DOM.hasAttrib(elem, 'href');
}, dom);
if (baseElem) {
base = urlUtil.resolve(base, baseElem.attribs.href);
}
var strict = config.strict;
var idMap = mapIds(dom);
function _getItems (nodes, isTopLevel) {
var items = [];
nodes.forEach(function (node) {
var childIsTopLEvel = isTopLevel;
var isStrictItem = isItem(node) && !isProperty(node);
var isNonStrictItem = isItem(node) && isTopLevel;