lib/types.js
function qualify(name, namespace) {
  if (~name.indexOf('.')) {
    name = name.replace(/^\./, ''); // Allow absolute referencing.
  } else if (namespace) {
    name = namespace + '.' + name;
  }
  name.split('.').forEach(function (part) {
    if (!isValidName(part)) {
      throw new Error(f('invalid name: %j', name));
    }
  });
  var tail = unqualify(name);
  // Primitives are always in the global namespace.
  return isPrimitive(tail) ? tail : name;
}
function qualify(name, namespace) {
  if (~name.indexOf('.')) {
    name = name.replace(/^\./, ''); // Allow absolute referencing.
  } else if (namespace) {
    name = namespace + '.' + name;
  }
  name.split('.').forEach(function (part) {
    if (!isValidName(part)) {
      throw new Error(f('invalid name: %j', name));
    }
  });
  var tail = unqualify(name);
  // Primitives are always in the global namespace.
  return isPrimitive(tail) ? tail : name;
}
function qualify ( name , namespace ) { if ( ~ name . indexOf ( '.' ) ) { name = name . replace ( / ^\. / , '' ) ; // Allow absolute referencing. } else if ( namespace ) { name = namespace + '.' + name ; } name . split ( '.' ) . forEach ( function ( part ) { if ( ! isValidName ( part ) ) { throw new Error ( f ( 'invalid name: %j' , name ) ) ; } } ) ; var tail = unqualify ( name ) ; // Primitives are always in the global namespace. return isPrimitive ( tail ) ? tail : name ; }
Verify and return fully qualified name.

@param name {String} Full or short name. It can be prefixed with a dot to
force global namespace.
@param namespace {String} Optional namespace.
Verify and return fully qualified name .