UNPKG

react-hooks-global-states

Version:

A package to easily handle global state across your React components using hooks.

1 lines 933 B
var t;t=()=>(()=>{"use strict";var t={};return((t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(()=>{let t=0;const e=()=>(t===Number.MAX_SAFE_INTEGER&&(t=0),t++),o=(t,e)=>{var o;return(null===(o=globalThis.crypto)||void 0===o?void 0:o.randomUUID)?(null!=t?t:"")+globalThis.crypto.randomUUID():(null!=t?t:"")+Date.now().toString(36)+e.toString(36)},r=t=>o(t,e());return r.for=t=>{const r=()=>o(t,e());return r.is=e=>"string"==typeof e&&e.startsWith(t),r.assert=function(e){if(!r.is(e))throw new Error(`The value "${String(e)}" does not match the expected prefix "${String(t)}"`)},r.strict=()=>r,r},r.of=()=>r.for(""),r.strict=()=>r,r})(),e.default=e.uniqueId})(0,t),t})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():this["react-hooks-global-states"]=t();