all files / elementx/ svg-attribute-namespace.js

100% Statements 7/7
100% Branches 4/4
100% Functions 1/1
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18                17×        
 
module.exports = isSvgAttribute
 
var ns = {
  ev: 'http://www.w3.org/2001/xml-events',
  xlink: 'http://www.w3.org/1999/xlink',
  xml: 'http://www.w3.org/XML/1998/namespace',
  xmlns: 'http://www.w3.org/2000/xmlns/'
}
 
function isSvgAttribute (attr) {
  if (attr.indexOf(':') === -1) return null
  var prefix = attr.split(':', 1)[0]
  return ns.hasOwnProperty(prefix)
    ? ns[prefix]
    : null
}