mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
16 lines
529 B
JavaScript
16 lines
529 B
JavaScript
function parseConfiguration(configuration) {
|
|
const configValues = configuration.split('|')
|
|
.reduce((map, next) => {
|
|
const parameterParts = next.split('=');
|
|
if (parameterParts.length === 2) {
|
|
map[parameterParts[0].toLowerCase()] = parameterParts[1];
|
|
}
|
|
return map;
|
|
}, {});
|
|
if (configValues.providers) {
|
|
configValues.providers = configValues.providers.split(',').map(provider => provider.toLowerCase());
|
|
}
|
|
return configValues;
|
|
}
|
|
|
|
module.exports = parseConfiguration; |