great-tariff
Version:
A satirical NPM package that lets you apply fake tariffs to imported modules in your JavaScript project.
6 lines • 1.81 kB
JavaScript
import{a as o,b as f,d as u,e as g}from"./chunk-DQT2G2TW.js";function m({pkg:e,action:r,rate:i}){let t=[`The way "${e}" treats us is horrible. Just horrible.`,`"${e}"? Disaster. Sad. We're gonna fix it.`,`"${e}" has been taking advantage of us for years. Not anymore.`],n=[`"${e}"? Total joke. We're gonna delay it until it's great again.`,"It's not a delay. It's a negotiation tactic. Very strong."],a=[`We're putting a big, beautiful tariff on "${e}" \u2013 maybe the biggest ever. People are talking.`,`Nobody knows "${e}" better than me. And it needs a tariff. Believe me.`,`Tremendous tariff on "${e}". It's going to be so fair, you won't believe it.`,`We used to import "${e}" for free. Can you believe that! Not anymore!`,`I talked to many smart people \u2014 they all agree "${e}" needs a tariff.`],s=r==="block"?t:r==="delay"?n:a,d=["\u{1F6A8} Tariff Alert!","\u{1F4E2} Presidential Import Tax in Effect:","\u{1F1FA}\u{1F1F8} Making Imports Great Again...",`\u{1F9F1} Building a firewall against "${e}"...`,`\u{1F575}\uFE0F Evaluating "${e}" for national import security...`],y=i?`This will be a ${i}% tariff. Historic.`:"No free rides here, folks.",l=o(c=>c[Math.floor(Math.random()*c.length)],"random");return`${l(d)}
\u{1F5E3}\uFE0F ${l(s)}
\u{1F4CA} ${y}`}o(m,"getQuote");var b=o(e=>new Promise(r=>setTimeout(r,e)),"delay");async function $(e){let i=g().policies?.[e];if(!i)return f(e);let{action:t,tariffRate:n=10}=i,a=m({pkg:e,action:t,rate:n});if(t==="block")throw new Error(`\u{1F6D1} Import Blocked: "${e}"
${a}`);if(t==="delay"){let s=n*10;console.log(`${a}
\u23F3 Holding import for ${s}ms...`),await b(s)}return t==="log"&&console.warn(a),f(e)}o($,"imposeTariff");var P={imposeTariff:$,setConfig:u};export{P as default,$ as imposeTariff,u as setConfig};
//# sourceMappingURL=index.js.map