Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/string/index.ts>hyphenate

A JavaScript extension package for building strong and modern applications.
Latest
function hyphenate
import { hyphenate } from "https://deno.land/x/ayonli_jsext@v0.9.72/string/index.ts";

Replaces the spaces between non-empty characters of the string with hyphens (-).

Examples

Example 1

import { hyphenate } from "@ayonli/jsext/string";

console.log(hyphenate("hello world")); // hello-world
console.log(hyphenate("hello   world")); // hello-world

Parameters

str: string

Returns

string