0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
natemoo-re 2022-03-10 00:10:48 +00:00 committed by GitHub Actions
parent ae8d925666
commit 518331f560

View file

@ -32,14 +32,14 @@ class Slots {
if (slots) {
for (const key of Object.keys(slots)) {
if ((this as any)[key] !== undefined) {
throw new Error(`Unable to create a slot named "${key}". "${key}" is a reserved slot name!\nPlease update the name of this slot.`)
throw new Error(`Unable to create a slot named "${key}". "${key}" is a reserved slot name!\nPlease update the name of this slot.`);
}
Object.defineProperty(this, key, {
get() {
return true;
},
enumerable: true
})
enumerable: true,
});
}
}
}
@ -52,11 +52,11 @@ class Slots {
public async render(name: string) {
if (!this.#slots) return undefined;
if (this.#cache.has(name)) {
const result = this.#cache.get(name)
const result = this.#cache.get(name);
return result;
};
}
if (!this.has(name)) return undefined;
const content = await renderSlot(this.#result, this.#slots[name]).then(res => res != null ? res.toString() : res);
const content = await renderSlot(this.#result, this.#slots[name]).then((res) => (res != null ? res.toString() : res));
this.#cache.set(name, content);
return content;
}