refactor: clean up, fix & remove outdated code (#228)

* dev: refactor and remove redundant code

* docs(music): update `Library` API ref

* docs: update examples

* chore: update lock file
This commit is contained in:
LuanRT
2022-11-06 03:32:16 -03:00
committed by GitHub
parent 1eda93ee08
commit aa334aacbd
50 changed files with 2006 additions and 2403 deletions

View File

@@ -1,4 +1,5 @@
import package_json from '../../package.json';
import { Memo } from '../parser/helpers';
import { FetchFunction } from './HTTPClient';
import userAgents from './user-agents.json';
@@ -151,9 +152,18 @@ export function timeToSeconds(time: string) {
}
}
/**
* Throws an error if given parameters are undefined.
*/
export function concatMemos(...iterables: Memo[]) {
const memo = new Memo();
for (const iterable of iterables) {
for (const item of iterable) {
memo.set(...item);
}
}
return memo;
}
export function throwIfMissing(params: object) {
for (const [ key, value ] of Object.entries(params)) {
if (!value)