(self: string): stringConverts a kebab-case string to snake_case.
Example (Converting kebab-case to snake_case)
import { String } from "effect"
console.log(String.kebabToSnake("hello-world")) // "hello_world"
console.log(String.kebabToSnake("foo-bar-baz")) // "foo_bar_baz"transforming
Source effect/String.ts:11641 lines
export const const kebabToSnake: (
self: string
) => string
Converts a kebab-case string to snake_case.
Example (Converting kebab-case to snake_case)
import { String } from "effect"
console.log(String.kebabToSnake("hello-world")) // "hello_world"
console.log(String.kebabToSnake("foo-bar-baz")) // "foo_bar_baz"
kebabToSnake = (self: stringself: string): string => self: stringself.String.replace(searchValue: {
[Symbol.replace](string: string, replaceValue: string): string;
}, replaceValue: string): string (+3 overloads)
Passes a string and
{@linkcode
replaceValue
}
to the [Symbol.replace] method on
{@linkcode
searchValue
}
. This method is expected to implement its own replacement algorithm.
replace(/-/g, "_")