docs/static/bundle.js
function normalizePathParts(parts) {

        // IMPORTANT: It is assumed that parts[0] === "" because this method is used to
        // join an absolute path to a relative path
        var i;
        var len = 0;

        var numParts = parts.length;

        for (i = 0; i < numParts; i++) {
            var part = parts[i];

            if (part === '.') {
                // ignore parts with just "."
                /*
                // if the "." is at end of parts (e.g. ["a", "b", "."]) then trim it off
                if (i === numParts - 1) {
                    //len--;
                }
                */
            } else if (part === '..') {
                // overwrite the previous item by decrementing length
                len--;
            } else {
                // add this part to result and increment length
                parts[len] = part;
                len++;
            }
        }

        if (len === 1) {
            // if we end up with just one part that is empty string
            // (which can happen if input is ["", "."]) then return
            // string with just the leading slash
            return '/';
        } else if (len > 2) {
            // parts i s
            // ["", "a", ""]
            // ["", "a", "b", ""]
            if (parts[len - 1].length === 0) {
                // last part is an empty string which would result in trailing slash
                len--;
            }
        }

        // truncate parts to remove unused
        parts.length = len;
        return parts.join('/');
    }
function normalizePathParts(parts) {

        // IMPORTANT: It is assumed that parts[0] === "" because this method is used to
        // join an absolute path to a relative path
        var i;
        var len = 0;

        var numParts = parts.length;

        for (i = 0; i < numParts; i++) {
            var part = parts[i];

            if (part === '.') {
                // ignore parts with just "."
                /*
                // if the "." is at end of parts (e.g. ["a", "b", "."]) then trim it off
                if (i === numParts - 1) {
                    //len--;
                }
                */
            } else if (part === '..') {
                // overwrite the previous item by decrementing length
                len--;
            } else {
                // add this part to result and increment length
                parts[len] = part;
                len++;
            }
        }

        if (len === 1) {
            // if we end up with just one part that is empty string
            // (which can happen if input is ["", "."]) then return
            // string with just the leading slash
            return '/';
        } else if (len > 2) {
            // parts i s
            // ["", "a", ""]
            // ["", "a", "b", ""]
            if (parts[len - 1].length === 0) {
                // last part is an empty string which would result in trailing slash
                len--;
            }
        }

        // truncate parts to remove unused
        parts.length = len;
        return parts.join('/');
    }
function normalizePathParts ( parts ) { // IMPORTANT: It is assumed that parts[0] === "" because this method is used to // join an absolute path to a relative path var i ; var len = 0 ; var numParts = parts . length ; for ( i = 0 ; i < numParts ; i ++ ) { var part = parts [ i ] ; if ( part === '.' ) { // ignore parts with just "." /*
                // if the "." is at end of parts (e.g. ["a", "b", "."]) then trim it off
                if (i === numParts - 1) {
                    //len--;
                }
                */ } else if ( part === '..' ) { // overwrite the previous item by decrementing length len -- ; } else { // add this part to result and increment length parts [ len ] = part ; len ++ ; } } if ( len === 1 ) { // if we end up with just one part that is empty string // (which can happen if input is ["", "."]) then return // string with just the leading slash return '/' ; } else if ( len > 2 ) { // parts i s // ["", "a", ""] // ["", "a", "b", ""] if ( parts [ len - 1 ] . length === 0 ) { // last part is an empty string which would result in trailing slash len -- ; } } // truncate parts to remove unused parts . length = len ; return parts . join ( '/' ) ; }
This function will take an array of path parts and normalize them by handling handle ".." and "."
and then joining the resultant string.

@param {Array} parts an array of parts that presumedly was split on the "/" character.
This function will take an array of path parts and normalize them by handling handle .. and . and then joining the resultant string .