fixup! diigo-cache: RSS in diigo's export shape, from cached items
compare-export.ts: Object.fromEntries(Object.entries(…).map(…)) as objectMap(original, mapFn), with @endo/common's signature. Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
21505a5b8f
commit
dc4f23ad04
1 file changed
+7
-1
@@ -15,6 +15,12 @@ type Item = Record<string, unknown>;
|
||||
/** one export item, as read */
|
||||
type Exported = { title: string; link: string; description: string };
|
||||
|
||||
/** a new object with each value mapped; keys kept (as `objectMap` in
|
||||
* @endo/common) */
|
||||
export function objectMap<V, W>(original: Record<string, V>, mapFn: (value: V, key: string) => W): Record<string, W> {
|
||||
return Object.fromEntries(Object.entries(original).map(([k, v]) => [k, mapFn(v, k)]));
|
||||
}
|
||||
|
||||
const FORBIDDEN = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
|
||||
const clean = (s: string) => s.replace(FORBIDDEN, "");
|
||||
|
||||
@@ -148,7 +154,7 @@ export function main(
|
||||
export: theirs.length,
|
||||
cache: ours.length,
|
||||
complete,
|
||||
...Object.fromEntries(Object.entries(report).map(([k, v]) => [k, v.length])),
|
||||
...objectMap(report, (links) => links.length),
|
||||
};
|
||||
stdout.write(`${JSON.stringify(counts, null, 1)}\n`);
|
||||
exit(0);
|
||||
|
||||
Reference in new issue
Block a user