Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // unobfuscated from https://virmach.app/ , retrieved on 2020-12-09 01:20 UTC
- // original script archived at https://web.archive.org/web/20201208225523js_/https://virmach.app/src.a918aee7.js
- function valuation(input) {
- var price = Number(input['price'].match(/\d[\d.]*/)[0]);
- var value = (5 * input['cpu'] + Number(input['ram']) / 1024 * 3 + input['hdd'] * (5 - Math.log(input['hdd']) / 3.0081547935525483) / 10 + 4 * (input['ips'] - 1)) / (input['virt'].match(/KVM/i) ? 1 : 2);
- value *= 1.05,
- input['ram'] < 256 && (value *= 0.8),
- input['ram'] < 512 && (value *= 0.85),
- input['ram'] < 1024 && (value *= 0.9),
- input['hdd'] < 5 && (value *= 0.25),
- input['bw'] < 200 && (value *= 0.25);
- var percentOff = 100 - Math.floor(price / value * 100)
- , annotation = '';
- return !(annotation = percentOff >= 65 ? 'best' : percentOff >= 45 ? 'great' : percentOff >= 35 ? 'good' : percentOff >= 20 ? 'average' : '') && price <= 8.5 && (annotation = 'cheap'),
- input['bw'] < 200 && (annotation = ''),
- {
- 'price': price,
- 'percentOff': percentOff,
- 'value': value,
- 'annotation': annotation
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement