Sha256: 1143318400a0da3b23951a6ec8e5ba7f787d8603064a02c9d023f6dc383bf709
Contents?: true
Size: 711 Bytes
Versions: 33
Compression:
Stored size: 711 Bytes
Contents
import {DelimiterCase} from './delimiter-case'; /** Convert a string literal to snake-case. This can be useful when, for example, converting a camel-cased object property to a snake-cased SQL column name. @example ``` import {SnakeCase} from 'type-fest'; // Simple const someVariable: SnakeCase<'fooBar'> = 'foo_bar'; // Advanced type SnakeCasedProperties<T> = { [K in keyof T as SnakeCase<K>]: T[K] }; interface ModelProps { isHappy: boolean; fullFamilyName: string; foo: number; } const dbResult: SnakeCasedProperties<ModelProps> = { 'is_happy': true, 'full_family_name': 'Carla Smith', foo: 123 }; ``` @category Template Literals */ export type SnakeCase<Value> = DelimiterCase<Value, '_'>;
Version data entries
33 entries across 33 versions & 1 rubygems