Utilities
removeHash

removeHash

Removes the hash fragment from a URL.

Installation

npm install @madeinhaus/utils

Import

import { removeHash } from '@madeinhaus/utils';

Parameters

  • url (string): The URL to remove the hash fragment from.

Returns

  • (string): The URL without the hash fragment.

Usage

import { removeHash } from '@madeinhaus/utils';
 
const url = 'https://example.com/#section1';
const urlWithoutHash = removeHash(url); // 'https://example.com/'

In this example, we import the removeHash function from the @madeinhaus/utils package and use it to remove the hash fragment from a URL.