examples/HTML StarterKit/lib/durandal/js/viewLocator.js
function(modulesPath, viewsPath, areasPath) {
            modulesPath = modulesPath || 'viewmodels';
            viewsPath = viewsPath || 'views';
            areasPath = areasPath || viewsPath;

            var reg = new RegExp(escape(modulesPath), 'gi');

            this.convertModuleIdToViewId = function (moduleId) {
                return moduleId.replace(reg, viewsPath);
            };

            this.translateViewIdToArea = function (viewId, area) {
                if (!area || area == 'partial') {
                    return areasPath + '/' + viewId;
                }
                
                return areasPath + '/' + area + '/' + viewId;
            };
        }
function(modulesPath, viewsPath, areasPath) {
            modulesPath = modulesPath || 'viewmodels';
            viewsPath = viewsPath || 'views';
            areasPath = areasPath || viewsPath;

            var reg = new RegExp(escape(modulesPath), 'gi');

            this.convertModuleIdToViewId = function (moduleId) {
                return moduleId.replace(reg, viewsPath);
            };

            this.translateViewIdToArea = function (viewId, area) {
                if (!area || area == 'partial') {
                    return areasPath + '/' + viewId;
                }
                
                return areasPath + '/' + area + '/' + viewId;
            };
        }
function ( modulesPath , viewsPath , areasPath ) { modulesPath = modulesPath || 'viewmodels' ; viewsPath = viewsPath || 'views' ; areasPath = areasPath || viewsPath ; var reg = new RegExp ( escape ( modulesPath ) , 'gi' ) ; this . convertModuleIdToViewId = function ( moduleId ) { return moduleId . replace ( reg , viewsPath ) ; } ; this . translateViewIdToArea = function ( viewId , area ) { if ( ! area || area == 'partial' ) { return areasPath + '/' + viewId ; } return areasPath + '/' + area + '/' + viewId ; } ; }
Allows you to set up a convention for mapping module folders to view folders. It is a convenience method that customizes `convertModuleIdToViewId` and `translateViewIdToArea` under the covers.
@method useConvention
@param {string} [modulesPath] A string to match in the path and replace with the viewsPath. If not specified, the match is 'viewmodels'.
@param {string} [viewsPath] The replacement for the modulesPath. If not specified, the replacement is 'views'.
@param {string} [areasPath] Partial views are mapped to the "views" folder if not specified. Use this parameter to change their location.
Allows you to set up a convention for mapping module folders to view folders . It is a convenience method that customizes convertModuleIdToViewId and translateViewIdToArea under the covers .