@crazy-thursday/use-kfc
Version:
generate crazy thursday info hooks!
3 lines (2 loc) • 1.34 kB
JavaScript
(function(n,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(n=typeof globalThis<"u"?globalThis:n||self,u(n["use-kfc"]={},n.React))})(this,function(n,u){"use strict";function s(){return new Date().getDay()===4}function d(e){return Math.floor(Math.random()*e)}function f(e){const t=u.useRef(e);return u.useMemo(()=>t.current!==e?(t.current=e,e):t.current,[e])}const m={id:"0000TURSDAY_KFC",content:"crazy thursday, vme50!"};function R(e){var i,h,y,o;const a=u.useRef(s()).current||(e==null?void 0:e.skipDayCheck),c=u.useRef(),M=f((i=e==null?void 0:e.refreshSignal)!=null?i:c.current),l=d((o=(y=(h=e==null?void 0:e.slogenList)==null?void 0:h.filter(r=>r.id!==c.current))==null?void 0:y.length)!=null?o:0);return a||console.error("today is not thursday!!!"),{slogen:u.useMemo(()=>{if(!a)return"";const{slogenList:r}=e!=null?e:{};if(Array.isArray(r)&&r.length){let g=r[0];r.length>1&&(g=r.filter(S=>S.id!==c.current)[l]);const{content:D,id:I}=g;return c.current=I,D}return m.content},[l,M])}}function T(e){return Object.values(e)}n.default=R,n.useManualRefresh=f,n.useParseSlogen=T,n.useRandomIndex=d,n.useThursday=s,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
//# sourceMappingURL=use-kfc.umd.js.map