'use strict';
function checkMatch(nodeA, nodeB) {
if (nodeA.type === 'atrule' && nodeB.type === 'atrule') {
return (
nodeA.params === nodeB.params &&
nodeA.name.toLowerCase() === nodeB.name.toLowerCase()
);
}
return nodeA.type === nodeB.type;
}
function sameParent(nodeA, nodeB) {
if (!nodeA.parent) {
return !nodeB.parent;
}
if (!nodeB.parent) {
return false;
}
if (!checkMatch(nodeA.parent, nodeB.parent)) {
return false;
}
return sameParent(nodeA.parent, nodeB.parent);
}
module.exports = sameParent;