npm i sub-of
import { subOf } from "sub-of"
subOf("https://evil.com", "https://safe.site") // False
subOf("https://www.safe.site", "https://safe.site") // True
subOf("https://www.unsafe.site") // [window.location = "https://safe.site"] False
Licensed under an MIT license by RedYetiDev