Skip to main content
Module

x/scaffold/src/deps/types.ts>DelimiterCase

scaffold your next project with style and 💗
Latest
type alias DelimiterCase
import { type DelimiterCase } from "https://deno.land/x/scaffold@0.3.0/src/deps/types.ts";

Convert a string literal to a custom string delimiter casing.

This can be useful when, for example, converting a camel-cased object property to an oddly cased one.

Examples

Example 1

import type {DelimiterCase} from 'type-fest';

// Simple

const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar';

// Advanced

type OddlyCasedProperties<T> = {
	[K in keyof T as DelimiterCase<K, '#'>]: T[K]
};

interface SomeOptions {
	dryRun: boolean;
	includeFile: string;
	foo: number;
}

const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
	'dry#run': true,
	'include#file': 'bar.js',
	foo: 123
};

Type Parameters

Value
Delimiter extends string
definition: Value extends string ? StringArrayToDelimiterCase<SplitIncludingDelimiters<Value, WordSeparators | UpperCaseCharacters>, true, WordSeparators, UpperCaseCharacters, Delimiter> : Value