function processAttributes(
  node,
  deprecatedAttrs,
  params,
  attributesInStylesheet,
) {
  if (!deprecatedAttrs) {
    return;
  }

  if (deprecatedAttrs.safe) {
    deprecatedAttrs.safe.forEach((name) => {
      if (attributesInStylesheet.has(name)) {
        return;
      }
      delete node.attributes[name];
    });
  }

  if (params.removeUnsafe && deprecatedAttrs.unsafe) {
    deprecatedAttrs.unsafe.forEach((name) => {
      if (attributesInStylesheet.has(name)) {
        return;
      }
      delete node.attributes[name];
    });
  }
}
@param {import('../lib/types.js').XastElement} node
@param {{ safe?: Set<string>; unsafe?: Set<string> }|undefined} deprecatedAttrs
@param {import('../lib/types.js').DefaultPlugins['removeDeprecatedAttrs']} params
@param {Set<string>} attributesInStylesheet