{"version":3,"file":"createCurrentHook.cjs","names":[],"sources":["../src/createCurrentHook.ts"],"sourcesContent":["import type { Hooks, StoreKey } from './types';\n\n/**\n * Returns a function which, when invoked, will return the name of the\n * currently running hook, or `null` if no hook of the given type is currently\n * running.\n *\n * @param hooks    Hooks instance.\n * @param storeKey\n *\n * @return Function that returns the current hook name or null.\n */\nfunction createCurrentHook(\n\thooks: Hooks,\n\tstoreKey: StoreKey\n): () => string | null {\n\treturn function currentHook() {\n\t\tconst hooksStore = hooks[ storeKey ];\n\t\tconst currentArray = Array.from( hooksStore.__current );\n\t\treturn currentArray.at( -1 )?.name ?? null;\n\t};\n}\n\nexport default createCurrentHook;\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,SAAS,kBACR,OACA,UACsB;CACtB,OAAO,SAAS,cAAc;EAC7B,MAAM,aAAa,MAAO;EAE1B,OADqB,MAAM,KAAM,WAAW,SAC1B,CAAC,CAAC,GAAI,EAAG,CAAC,EAAE,QAAQ;CACvC;AACD"}