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>
18 lines
431 B
Text
18 lines
431 B
Text
import * as Either from 'fp-ts/Either';
|
|
import { pipe } from 'fp-ts/function';
|
|
|
|
const arrayToPath = (paths: Either.Either<string, number>[]): string =>
|
|
paths.reduce(
|
|
(previous, path, index) =>
|
|
pipe(
|
|
path,
|
|
Either.fold(
|
|
(key) => `${index > 0 ? '.' : ''}${key}`,
|
|
(key) => `[${key}]`,
|
|
),
|
|
(path) => `${previous}${path}`,
|
|
),
|
|
'',
|
|
);
|
|
|
|
export default arrayToPath;
|