Rocky_Mountain_Vending/.pnpm-store/v10/files/10/19058fbcfe4e6bc04a55ba8840a794c078e13e34463f7524e377b1e72536a45e3761d0decb96e07daa185d8e13fe92a003524e1adac6337e31c4fe69e2e41e
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

28 lines
1.1 KiB
Text

import { EndpointError } from "../types";
import { evaluateTemplate } from "./evaluateTemplate";
export const getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
...acc,
[propertyKey]: group.getEndpointProperty(propertyVal, options),
}), {});
export const getEndpointProperty = (property, options) => {
if (Array.isArray(property)) {
return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
}
switch (typeof property) {
case "string":
return evaluateTemplate(property, options);
case "object":
if (property === null) {
throw new EndpointError(`Unexpected endpoint property: ${property}`);
}
return group.getEndpointProperties(property, options);
case "boolean":
return property;
default:
throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
}
};
export const group = {
getEndpointProperty,
getEndpointProperties,
};