JSFiddle - React, Tailwind, and code Playground

by kougiland

JavaScript

courses = [
                { route: ['', 'uebersicht'], moduleId: 'overview', title: 'Ăśbersicht', nav: 1 },
                { route: 'marktplatz*details', moduleId: 'marketplace/index', title: 'Marktplatz', nav: 2, hash: '#marktplatz' },
                { route: 'bewertungen', moduleId: 'rating', title: 'Bewertungen', nav: 3, hash: '#bewertungen' },
                { route: 'profil*details', moduleId: 'profile/index', title: 'Profil', nav: 4, hash: '#profil' },
                { route: 'breezeexample', moduleId: 'breezeexample', title: 'breezeexample', nav: 5 },
                { route: 'jaydataexample', moduleId: 'jaydataexample', title: 'jaydataexample', nav: 6, authorize: ["User", "Administrator"] },
                { route: 'account/login', moduleId: 'account/login', title: 'Login', nav: false, hash: "#account/login" },
                { route: 'account/externalloginconfirmation', moduleId: 'account/externalloginconfirmation', title: 'External login confirmation', nav: false, hash: "#account/externalloginconfirmation" },
                { route: 'account/externalloginfailure', moduleId: 'account/externalloginfailure', title: 'External login failure', nav: false, hash: "#account/externalloginfailure" },
                { route: 'account/register', moduleId: 'account/register', title: 'Register', nav: false, hash: "#account/register" },
                { route: 'account/manage', moduleId: 'account/manage', title: 'Manage account', nav: false, hash: "#account/manage", authorize: ["User", "Administrator"] },
            ];


var acceptedTypes = ["Administrator", "Visitor"];
/*
// ECMA 5
    
var resultSetA = (function(authTypes){
    return courses.filter(function(crs){
        return crs && crs.authorize 
        && crs.authorize.indexOf && authTypes.some(function(authType){
            return ~crs.authorize.indexOf(authType);
        });
    });
})(acceptedTypes);
console.log(JSON.stringify(resultSetA));
*/
//Compatibility with all browsers (ECMAScript...