Utilities
getHash

getHash

Returns the hash portion of a URL.

Installation

npm install @madeinhaus/utils

Import

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

Parameters

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

Returns

  • (string): The hash portion of the URL.

Usage

import { getHash } from '@madeinhaus/utils';
 
const url = 'https://example.com/path/to/resource#section1';
const hash = getHash(url); // 'section1'

In this example, we import the getHash function from the @madeinhaus/utils package and use it to extract the hash portion of a URL.