All files DefaultTemplate.js

100% Statements 16/16
100% Branches 6/6
100% Functions 4/4
100% Lines 16/16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35    1189x 1189x 1189x 1189x       3618x 3628x 3627x 3333x     284x         1674x 1803x 1803x 584x     1090x       811x 811x      
export default class DefaultTemplate {
    constructor (templateUri, routeParams, routeName) {
        this._partName = this._getPartName();
        this._templateUri = templateUri;
        this._routeParams = routeParams;
        this._routeName = routeName;
    }
 
    matchParsedValue (userUri, contextOptions, matchFunctions=this._matchFunctions) {
        for (let matchFunction of matchFunctions) {
            const matchFragment = matchFunction(userUri, contextOptions);
            if (matchFragment) {
                return matchFragment;
            }
        }
        return null;
    }
 
    generateParsedValue (userParams, contextOptions, generateFunctions=this._generateFunctions) {
        let parsedValue;
        for (let generateFunction of generateFunctions) {
            parsedValue = generateFunction(userParams, contextOptions);
            if (!parsedValue.isEmpty()) {
                return parsedValue;
            }
        }
        return parsedValue;
    }
 
    _initMatchGenerateFunctions () {
        this._matchFunctions = this._getMatchFunctions(...arguments);
        this._generateFunctions = this._getGenerateFunctions(...arguments);
    }
}