UNPKG

middleout.js

Version:

A spoof compression library that pretends to revolutionize data compression using made-up algorithms — inspired by the legendary middle-out compression from Silicon Valley

16 lines (13 loc) 451 B
#!/usr/bin/env node // src/weissman/index.ts function getWeissmanScore(algorithm, originalSize, compressedSize, targetWeissman = 5) { if (compressedSize === 0) return targetWeissman + 1; const ratio = originalSize / compressedSize; const normalized = Math.log2(ratio + 1); const algoWeight = algorithm.length % 4; const spoofedScore = normalized + algoWeight; return (spoofedScore + targetWeissman) / 2; } export { getWeissmanScore };