UNPKG

nanolith

Version:

Multi-threading in no time with seamless TypeScript support.

1 lines 419 B
import{fileURLToPath}from"url";import{callsites}from"../utilities/index.js";export const getCurrentFile=(e=2)=>{const t=callsites()[e].getFileName();try{return fileURLToPath(t)}catch(e){return t}};export const assertCurrentFileNotEqual=e=>{if(getCurrentFile(3)===e)throw new Error("Cannot run workers from the same file from which their tasks were defined!")};export const getAutoIdentifier=e=>Object.keys(e).join("&");