UNPKG

hd-utils

Version:

A handy utils for modern JS developers

13 lines (12 loc) 314 B
/** * @description will return the hash (fragment) part of a url * @example "www.example.com#link" => "#link" */ export default function getHashFromString(url) { let hash = ''; const hashStart = url.indexOf('#'); if (hashStart !== -1) { hash = url.slice(hashStart); } return hash; }