Rocky_Mountain_Vending/.pnpm-store/v10/files/f9/68bb172649be17a9ea791c09c88ed94b00501fb762b5c45c0d5c30c870dc45269c8472eedb76d2e54eea4bef7549f3045fc5b0869dd7471007ce293c369fce
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

47 lines
1.1 KiB
Text

import type {IsNumericLiteral} from './is-literal';
import type {IsNegative} from './numeric';
/**
Returns a new string which contains the specified number of copies of a given string, just like `String#repeat()`.
@example
```
import {StringRepeat} from 'type-fest';
declare function stringRepeat<
Input extends string,
Count extends number
>(input: Input, count: Count): StringRepeat<Input, Count>;
// The return type is the exact string literal, not just `string`.
stringRepeat('foo', 2);
//=> 'foofoo'
stringRepeat('=', 3);
//=> '==='
```
@category String
@category Template literal
*/
export type StringRepeat<
Input extends string,
Count extends number,
> = StringRepeatHelper<Input, Count>;
type StringRepeatHelper<
Input extends string,
Count extends number,
Counter extends never[] = [],
Accumulator extends string = '',
> =
IsNegative<Count> extends true
? never
: Input extends ''
? ''
: Count extends Counter['length']
? Accumulator
: IsNumericLiteral<Count> extends false
? string
: StringRepeatHelper<Input, Count, [...Counter, never], `${Accumulator}${Input}`>;