Shopify offers a rather fustrating solution for localization on the front-end and developers are likely at the behest of their slop served up as the "Geo" app... We are not animals. Anyway, this is a tiny little url parser to extract subfolder prefixes and provides determination for cases where you are employing your own solution and have a webshop operating multiple domains and/or targeting different markets using subfolders.
The typings will explain in rich detail each value in the closure. If you don't use TypeScript then maybe try acting like an adult.
Usage is simple, and only configuration required is setting you main domain, by default the function assumed your main domain is using a .com
extension, change this if it differs.