bit-twiddler 0.1.0

Cross-platform developer toolbox: bit manipulation, hashing, YAML/JSON/SQL, QR, Markdown, cron, and 40+ more tools — Tauri v2, no Node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Shared utilities (global - no ES module exports for Tauri static serving)
window.escHtml = (s) => String(s)
  .replace(/&/g, '&')
  .replace(/</g, '&lt;')
  .replace(/>/g, '&gt;')
  .replace(/"/g, '&quot;');

window.copyToClipboard = async (text, $btnElement) => {
  try {
    await navigator.clipboard.writeText(text);
    const originalText = $btnElement.text();
    $btnElement.text("Copied!");
    setTimeout(() => { $btnElement.text(originalText); }, 1500);
  } catch (err) {
    console.error('Failed to copy', err);
  }
};