url-env
Version:
Select an environment by url
3 lines (2 loc) • 630 B
JavaScript
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.urlEnv={}))})(this,(function(e){"use strict";function n(t,i=typeof window<"u"?window.location.href:""){const o=t.find(r=>i.startsWith(r[0]));if(!o)throw new Error("No matching environment found.");return{pair:o,url:o[0],env:o[1]}}function f(t,i=typeof window<"u"?window.location.href:""){return n(Object.entries(t),i)}e.fromArray=n,e.fromObject=f,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
//# sourceMappingURL=url-env.umd.js.map