Fork Horse repository, listed by its owner. Publisher snapshot.

.forkhorse/quick/brand.js

Snapshot at 34e3175

Containing directory

423 bytes · javascriptView raw
1export default async (ctx) => {
2  const text = await ctx.read("brand.json");
3  if (text === null) return { ok: false, message: "brand.json is missing." };
4  const brand = JSON.parse(text);
5  const ok = ["name", "slug", "mark"].every(key => typeof brand[key] === "string" && brand[key].trim().length > 0);
6  return { ok, message: ok ? "Brand fields are valid." : "Brand name, slug and mark must be non-empty strings." };
7};
8