Skip to main content
Module

x/froebel/surround.ts>default

A strictly typed utility library.
Go to Latest
variable default
import { default } from "https://deno.land/x/froebel@v0.20.0/surround.ts";

Surrounds the str with surrounding. surrounding must have an even length.

Examples

Example 1

surround("foo", "()")      // "(foo)"
surround("foo", "({[]})")  // "({[foo]})"

type

<A extends string, B extends string>(str: A, surrounding: B) => B extends "" ? A : IsEvenLength<B> extends true ? Surround<A, B> : never