- Add Rust shutdown command that kills sidecar and exits app cleanly
- Frontend calls invoke('shutdown') after vault flush on close
- Add auth.ts, entries.ts, and normalize.ts backend modules
- Add EditorPanel.svelte component
- Expand entries store with full CRUD support
- Add JournalEntryDtos and JournalEntryDtoMapper in Journal.Core
- Update entry search, fragments, and sidecar CLI
Co-Authored-By: Oz <oz-agent@warp.dev>
19 lines
467 B
TypeScript
19 lines
467 B
TypeScript
type UnknownObject = Record<string, unknown>;
|
|
|
|
function asObject(value: unknown): UnknownObject | undefined {
|
|
return value && typeof value === "object" ? (value as UnknownObject) : undefined;
|
|
}
|
|
|
|
export function pickCase<T>(
|
|
source: unknown,
|
|
camelKey: string,
|
|
pascalKey: string,
|
|
fallback: T
|
|
): T {
|
|
const obj = asObject(source);
|
|
if (!obj) return fallback;
|
|
|
|
const value = obj[camelKey] ?? obj[pascalKey];
|
|
return (value as T | undefined) ?? fallback;
|
|
}
|