'use strict';

var namespaces = require('./namespaces.js');

function namespace(name) {
  var prefix = name += "", i = prefix.indexOf(":");
  if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
  return namespaces.default.hasOwnProperty(prefix) ? {space: namespaces.default[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins
}

module.exports = namespace;
