Hyperlinkv0.8.0-beta.28

String

String.noCaseconsteffect/String.ts:1248
(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.

Source effect/String.ts:124823 lines
export 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
} = dual((args) => typeof args[0] === "string", (input: 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 => {
  const delimiter = options?.delimiter ?? " "
  const transform = options?.transform ?? toLowerCase
  return normalizeCase(input, SPLIT_REGEXP, STRIP_REGEXP, delimiter, transform)
})
Referenced by 5 symbols