Rocky_Mountain_Vending/.pnpm-store/v10/files/a2/5b949e402100fabfca3ad64f7fcc099ef6f52e4708d73b2900f487274dab79ff13b135756e65a441b48668ff22462a7a7d9d69dfb434da082b1840d5743e66
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

36 lines
1.1 KiB
Text

import { invariant } from './utils';
/**
* Partition a pattern into a list of literals and placeholders
* https://tc39.es/ecma402/#sec-partitionpattern
* @param pattern
*/
export function PartitionPattern(pattern) {
var result = [];
var beginIndex = pattern.indexOf('{');
var endIndex = 0;
var nextIndex = 0;
var length = pattern.length;
while (beginIndex < pattern.length && beginIndex > -1) {
endIndex = pattern.indexOf('}', beginIndex);
invariant(endIndex > beginIndex, "Invalid pattern ".concat(pattern));
if (beginIndex > nextIndex) {
result.push({
type: 'literal',
value: pattern.substring(nextIndex, beginIndex),
});
}
result.push({
type: pattern.substring(beginIndex + 1, endIndex),
value: undefined,
});
nextIndex = endIndex + 1;
beginIndex = pattern.indexOf('{', nextIndex);
}
if (nextIndex < length) {
result.push({
type: 'literal',
value: pattern.substring(nextIndex, length),
});
}
return result;
}