Files
test_server/node_modules/fast-xml-parser/src/ignoreAttributes.js
girinb 485098cd1a link
2025-05-29 15:41:51 +09:00

20 lines
611 B
JavaScript

function getIgnoreAttributesFn(ignoreAttributes) {
if (typeof ignoreAttributes === 'function') {
return ignoreAttributes
}
if (Array.isArray(ignoreAttributes)) {
return (attrName) => {
for (const pattern of ignoreAttributes) {
if (typeof pattern === 'string' && attrName === pattern) {
return true
}
if (pattern instanceof RegExp && pattern.test(attrName)) {
return true
}
}
}
}
return () => false
}
module.exports = getIgnoreAttributesFn