Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
Something went wrong. Try again.
1234567891011121314import json5 from 'json5';
/** Filter an example config array to one configureAs type and optionally wrap it as an AIO config */export function transformConfig(data: string | object, configureAs: 'client' | 'source' | undefined, aio: boolean, name: string): object { let content: any = typeof data === 'string' ? json5.parse(data) : data; if (configureAs !== undefined && Array.isArray(content)) { const filtered = content.filter((x) => x.configureAs === undefined || x.configureAs === configureAs); content = aio ? { [configureAs === 'client' ? 'clients' : 'sources']: filtered.map((x) => ({ type: name, ...x })) } : filtered; } return content;}
export const toJson = (o: unknown) => JSON.stringify(o, null, 2);