2016-03-29 00:43:45 +02:00
|
|
|
(function (global, factory) {
|
2016-04-07 13:43:43 +02:00
|
|
|
if (typeof define === "function" && define.amd) {
|
|
|
|
define('ss.config', ['exports'], factory);
|
|
|
|
} else if (typeof exports !== "undefined") {
|
|
|
|
factory(exports);
|
|
|
|
} else {
|
|
|
|
var mod = {
|
|
|
|
exports: {}
|
|
|
|
};
|
|
|
|
factory(mod.exports);
|
|
|
|
global.ssConfig = mod.exports;
|
|
|
|
}
|
2016-03-29 00:43:45 +02:00
|
|
|
})(this, function (exports) {
|
2016-04-07 13:43:43 +02:00
|
|
|
'use strict';
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
value: true
|
|
|
|
});
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
function _classCallCheck(instance, Constructor) {
|
|
|
|
if (!(instance instanceof Constructor)) {
|
|
|
|
throw new TypeError("Cannot call a class as a function");
|
2016-03-29 00:43:45 +02:00
|
|
|
}
|
2016-04-07 13:43:43 +02:00
|
|
|
}
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
var _createClass = function () {
|
|
|
|
function defineProperties(target, props) {
|
|
|
|
for (var i = 0; i < props.length; i++) {
|
|
|
|
var descriptor = props[i];
|
|
|
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
|
|
descriptor.configurable = true;
|
|
|
|
if ("value" in descriptor) descriptor.writable = true;
|
|
|
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
|
|
}
|
|
|
|
}
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
return function (Constructor, protoProps, staticProps) {
|
|
|
|
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
|
|
if (staticProps) defineProperties(Constructor, staticProps);
|
|
|
|
return Constructor;
|
|
|
|
};
|
|
|
|
}();
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
var Config = function () {
|
|
|
|
function Config() {
|
|
|
|
_classCallCheck(this, Config);
|
|
|
|
}
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
_createClass(Config, null, [{
|
|
|
|
key: 'getSection',
|
|
|
|
value: function getSection(key) {
|
|
|
|
return window.ss.config.sections[key];
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
key: 'getTopLevelRoutes',
|
|
|
|
value: function getTopLevelRoutes() {
|
|
|
|
var topLevelRoutes = [];
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
Object.keys(window.ss.config.sections).forEach(function (key) {
|
|
|
|
var route = window.ss.config.sections[key].route;
|
|
|
|
var isTopLevelRoute = route.indexOf('/') === -1;
|
|
|
|
var isUnique = topLevelRoutes.indexOf(route) === -1;
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
if (isTopLevelRoute && isUnique) {
|
|
|
|
topLevelRoutes.push(route);
|
|
|
|
}
|
|
|
|
});
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
return topLevelRoutes;
|
|
|
|
}
|
|
|
|
}]);
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
return Config;
|
|
|
|
}();
|
2016-03-29 00:43:45 +02:00
|
|
|
|
2016-04-07 13:43:43 +02:00
|
|
|
exports.default = Config;
|
2016-03-29 00:43:45 +02:00
|
|
|
});
|