function normalize(path) {
    var bits = path.split('/');
    var i = 1;
    while (i < bits.length) {
      if (bits[i] === '..') {
        bits.splice(i-1, 1);
      } else if (bits[i] === '.') {
        bits.splice(i, 1);
      } else {
        i++;
      }
    }
    return bits.join('/');
  }
Lookup module names and resolve them by calling the definition function if
needed.
There are 2 ways to call this, either with an array of dependencies and a
callback to call when the dependencies are found (which can happen
asynchronously in an in-page context) or with a single string an no callback
where the dependency is resolved synchronously and returned.
The API is designed to be compatible with the CommonJS AMD spec and
RequireJS.
@param {string[]|string} deps A name, or names for the payload
@param {function|undefined} callback Function to call when the dependencies
are resolved
@return {undefined|object} The module required or undefined for
array/callback method