Skip to content

Commit 09dcbce

Browse files
Copilothotlong
andcommitted
style(plugin-dev): improve readability of compressed one-liner statements
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent cb869d9 commit 09dcbce

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

packages/plugins/plugin-dev/src/dev-plugin.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ function createCacheStub() {
4343
async get<T = unknown>(key: string): Promise<T | undefined> {
4444
const entry = store.get(key);
4545
if (!entry || (entry.expires && Date.now() > entry.expires)) {
46-
store.delete(key); misses++; return undefined;
46+
store.delete(key);
47+
misses++;
48+
return undefined;
4749
}
4850
hits++;
4951
return entry.value as T;
@@ -136,7 +138,10 @@ function createSearchStub() {
136138
return { hits, totalHits: hits.length, processingTimeMs: 0 };
137139
},
138140
async bulkIndex(object: string, documents: Array<{ id: string; document: Record<string, unknown> }>): Promise<void> {
139-
for (const d of documents) { if (!indexes.has(object)) indexes.set(object, new Map()); indexes.get(object)!.set(d.id, d.document); }
141+
if (!indexes.has(object)) indexes.set(object, new Map());
142+
for (const d of documents) {
143+
indexes.get(object)!.set(d.id, d.document);
144+
}
140145
},
141146
async deleteIndex(object: string): Promise<void> { indexes.delete(object); },
142147
};
@@ -271,7 +276,10 @@ function createMetadataStub() {
271276
const store = new Map<string, Map<string, unknown>>(); // type → (name → def)
272277
return {
273278
_dev: true, _serviceName: 'metadata',
274-
register(type: string, definition: any) { if (!store.has(type)) store.set(type, new Map()); store.get(type)!.set(definition.name ?? '', definition); },
279+
register(type: string, definition: any) {
280+
if (!store.has(type)) store.set(type, new Map());
281+
store.get(type)!.set(definition.name ?? '', definition);
282+
},
275283
get(type: string, name: string) { return store.get(type)?.get(name); },
276284
list(type: string) { return [...(store.get(type)?.values() ?? [])]; },
277285
unregister(type: string, name: string) { store.get(type)?.delete(name); },

0 commit comments

Comments
 (0)