(options?: {
readonly splitRegExp?: RegExp | ReadonlyArray<RegExp> | undefined
readonly stripRegExp?: RegExp | ReadonlyArray<RegExp> | undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}): (self: string) => string
(
self: string,
options?: {
readonly splitRegExp?: RegExp | ReadonlyArray<RegExp> | undefined
readonly stripRegExp?: RegExp | ReadonlyArray<RegExp> | undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}
): stringNormalizes a string by splitting it into word parts, transforming each part, and joining the parts with a configurable delimiter.
When to use
Use when you need custom word-case output with a delimiter or part transform that the fixed case helpers do not provide.
Source effect/String.ts:124823 lines
export const const noCase: {
(options?: {
readonly splitRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly stripRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}): (self: string) => string
(
self: string,
options?: {
readonly splitRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly stripRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}
): string
}
Normalizes a string by splitting it into word parts, transforming each part,
and joining the parts with a configurable delimiter.
When to use
Use when you need custom word-case output with a delimiter or part transform
that the fixed case helpers do not provide.
noCase: {
(options: | {
readonly splitRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly stripRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}
| undefined
options?: {
readonly splitRegExp?: RegExp | readonly RegExp[] | undefinedsplitRegExp?: RegExp | interface ReadonlyArray<T>ReadonlyArray<RegExp> | undefined
readonly stripRegExp?: RegExp | readonly RegExp[] | undefinedstripRegExp?: RegExp | interface ReadonlyArray<T>ReadonlyArray<RegExp> | undefined
readonly delimiter?: string | undefineddelimiter?: string | undefined
readonly transform?: | ((
part: string,
index: number,
parts: ReadonlyArray<string>
) => string)
| undefined
transform?: (part: stringpart: string, index: numberindex: number, parts: readonly string[]parts: interface ReadonlyArray<T>ReadonlyArray<string>) => string
}): (self: stringself: string) => string
(self: stringself: string, options: | {
readonly splitRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly stripRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}
| undefined
options?: {
readonly splitRegExp?: RegExp | readonly RegExp[] | undefinedsplitRegExp?: RegExp | interface ReadonlyArray<T>ReadonlyArray<RegExp> | undefined
readonly stripRegExp?: RegExp | readonly RegExp[] | undefinedstripRegExp?: RegExp | interface ReadonlyArray<T>ReadonlyArray<RegExp> | undefined
readonly delimiter?: string | undefineddelimiter?: string | undefined
readonly transform?: | ((
part: string,
index: number,
parts: ReadonlyArray<string>
) => string)
| undefined
transform?: (part: stringpart: string, index: numberindex: number, parts: readonly string[]parts: interface ReadonlyArray<T>ReadonlyArray<string>) => string
}): string
} = import dualdual((args: anyargs) => typeof args: anyargs[0] === "string", (input: stringinput: string, options: | {
readonly splitRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly stripRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}
| undefined
options?: {
readonly splitRegExp?: RegExp | readonly RegExp[] | undefinedsplitRegExp?: RegExp | interface ReadonlyArray<T>ReadonlyArray<RegExp> | undefined
readonly stripRegExp?: RegExp | readonly RegExp[] | undefinedstripRegExp?: RegExp | interface ReadonlyArray<T>ReadonlyArray<RegExp> | undefined
readonly delimiter?: string | undefineddelimiter?: string | undefined
readonly transform?: | ((
part: string,
index: number,
parts: ReadonlyArray<string>
) => string)
| undefined
transform?: (part: stringpart: string, index: numberindex: number, parts: readonly string[]parts: interface ReadonlyArray<T>ReadonlyArray<string>) => string
}): string => {
const const delimiter: stringdelimiter = options: | {
readonly splitRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly stripRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}
| undefined
options?.delimiter?: string | undefineddelimiter ?? " "
const const transform: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
transform = options: | {
readonly splitRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly stripRegExp?:
| RegExp
| ReadonlyArray<RegExp>
| undefined
readonly delimiter?: string | undefined
readonly transform?: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
}
| undefined
options?.transform?: | ((
part: string,
index: number,
parts: ReadonlyArray<string>
) => string)
| undefined
transform ?? const toLowerCase: <T extends string>(
self: T
) => Lowercase<T>
Converts a string to lowercase.
Example (Converting strings to lowercase)
import { pipe, String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(pipe("A", String.toLowerCase), "a")
assert.deepStrictEqual(String.toLowerCase("HELLO"), "hello")
toLowerCase
return const normalizeCase: (
input: string,
splitRegExp: ReadonlyArray<RegExp>,
stripRegExp: RegExp,
delimiter: string,
transform: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
) => string
normalizeCase(input: stringinput, const SPLIT_REGEXP: RegExp[]SPLIT_REGEXP, const STRIP_REGEXP: RegExpSTRIP_REGEXP, const delimiter: stringdelimiter, const transform: (
part: string,
index: number,
parts: ReadonlyArray<string>
) => string
transform)
})Referenced by 5 symbols