Skip to main content
Module

x/core_fn/uncurry/string/replace.ts>replace

A collection of built-in object method and property as currying function
Latest
variable replace
import { replace } from "https://deno.land/x/core_fn@v1.0.0-beta.16/uncurry/string/replace.ts";

Replaces matches for from in string or RegExp with to.

Examples

Example 1

replace('hello Tom', 'Tom', 'Bob') // 'hello Bob'
replace('hogehoge', 'hoge', 'fuga') // 'fugahoge'

type

<From extends string | RegExp, To extends string, T extends string>(
from: From,
to: To,
val: T,
) => Replace<T, From, To>