mirror of
https://github.com/kucherenko/jscpd.git
synced 2026-09-19 08:11:03 +08:00
e286818c92
A JavaScript/TypeScript file with any parse diagnostic (a redeclaration, a recoverable syntax error) was handed to the word-split fallback tokenizer. Its tokens then never matched an oxc-tokenized file, so every cross-file clone involving it vanished while its self-clones survived — the symptom reported in #1023, where a second copy of a function in one file made all a↔b clones disappear. Tokens come from the lexer, not the parser: only `panicked` (or an empty token stream) now triggers the fallback. Function extraction for --similarity uses the partial AST on recoverable errors the same way. Closes #1023.
12 lines
610 B
JavaScript
12 lines
610 B
JavaScript
export async function saveProfile(profile, store, clock) {
|
|
const record = toRecord(profile);
|
|
record.updatedAt = clock.now();
|
|
record.version = (record.version || 0) + 1;
|
|
record.normalizedEmail = profile.email.trim().toLowerCase();
|
|
record.displayName = [profile.firstName, profile.lastName].filter(Boolean).join(" ");
|
|
await store.put("profiles", record.id, record);
|
|
await audit("save-profile", record.id, record.version, clock.now());
|
|
await notify(profile.email, "profile-updated", { version: record.version });
|
|
return { id: record.id, version: record.version, updatedAt: record.updatedAt };
|
|
}
|