Reference

@muze-nl/metro-hashparams reference

import { parse, append, clear } from '@muze-nl/metro-hashparams'

parse(url)

const params = parse('https://example.com/#section?tab=profile')
console.log(params.get('tab'))

Returns a URLSearchParams object for the query part inside the hash. #?foo=bar and #section?foo=bar are recognised.

append(url, params)

const next = append('https://example.com/#section', { tab: 'profile' })
console.log(next.href) // https://example.com/#section?tab=profile

Returns a Metro URL with params appended to the hash.

clear(url)

const clean = clear('https://example.com/#section?tab=profile')

Returns a Metro URL with the hash query portion removed, preserving the rest of the hash.