mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
refactor: visitor view (#107)
* refactor: update api * refactor: visitor view * chore: update seed data
This commit is contained in:
@ -126,38 +126,6 @@ export function throttle(fn: FunctionType, delay: number) {
|
||||
};
|
||||
}
|
||||
|
||||
export function transformObjectToParamsString(object: KVObject): string {
|
||||
const params = [];
|
||||
const keys = Object.keys(object).sort();
|
||||
|
||||
for (const key of keys) {
|
||||
const val = object[key];
|
||||
if (val) {
|
||||
if (typeof val === "object") {
|
||||
params.push(...transformObjectToParamsString(val).split("&"));
|
||||
} else {
|
||||
params.push(`${key}=${val}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return params.join("&");
|
||||
}
|
||||
|
||||
export function transformParamsStringToObject(paramsString: string): KVObject {
|
||||
const object: KVObject = {};
|
||||
const params = paramsString.split("&");
|
||||
|
||||
for (const p of params) {
|
||||
const [key, val] = p.split("=");
|
||||
if (key && val) {
|
||||
object[key] = val;
|
||||
}
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
export function filterObjectNullKeys(object: KVObject): KVObject {
|
||||
if (!object) {
|
||||
return {};
|
||||
|
Reference in New Issue
Block a user