- Author:
- RasmusErik Voel Jensen
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- solsort.com
- Compo:
- canvas
- Demo link:
- https://js1k.com/2017-magic/demo/2699
- Shortlink:
- https://js1k.com/2699
- Blog post:
- please update here!
- Bytes:
- 986
- Chars:
- 686
- Submission
eval(s=(f=(i,o,p,c)=>(c=i.charCodeAt(p))?f(i,o+(c<256?i[p]:o.slice(c&2047,(c&2047)+(c>>11))),++p):o)(`/***᠁、态쀁ꀁ\n * ᡈえ恈쁈遈1K LZ77 source compression npm module袅See http://js1k-䃱.solsort.ᣱ for details炀㠁/\n\nvar䣰 = input => {\n⁈⌄out⬕ ''\n⬝᧓(⌄iᬐ0;ᬾ<㌒.length;)㬛䌞bes⌫0譚L⭑⭫䭚䌷j㍀j⍇; ++j⍗䭚挳k㍀k +㎢ &&㌒[⏍i] ==㬑⯟j]⎨k捗⁈}现if(k >孻菼⁈歼k갯ᬐj篿鰄歼Math.min(卼, 30)厊ᰛ孼< 3菼㬦+䏩i]殱++i呵 else쳊String.fromCharCodeⲞᯎ2048ᡆ尢琎ⓟ卼屵專䬦㌦㭚.replace(/\\\\/g, '\\\\\\\\'䕏嶘n㶤nꖭr㶤rꖭ0㶤0鶭[\$]㶤\$鶭\`㶤\`ᶭ⬝return '(f=(i,o,p,c)=>(c=i.c㴯At(p))?f♑+(c<256?i[p]:o.sliᶞc&ᴾ7,㺉)ṵ>>11))),++p):o)(\`'ᯎ涋ᳶ '\`,\`\`,0)'\nᰌᰛtypeof䄀⏧'object'䍗.exp⌏䃱\n洄document.write('<ᣴ>⚭\`\n>㣩㭏\n\n\${s㭏ᰌ>䣰(リ)弾坖䝥꽑罭⽑eval(蝖⾗羬)ᾦ⁈\`喘<ⶤ<'῀}\n`,``,0))
- Description
- Compress source code to self-extracting JS
- Base64 encoded
ZXZhbChzPShmPShpLG8scCxjKT0+KGM9aS5jaGFyQ29kZUF0KHApKT9mKGksbysoYz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3JpdGUoJzzho7Q+4pqtXGBcbj7jo6njrY9cblxuXCR7c+Otj+GwjD7ko7Ao44OqKeW8vuWdluSdpeq9kee9reK9kWV2YWwo6J2W4r6X576sKeG+puKBiFxg5ZaYPOK2pCZsdDsn4b+AfVxuYCxgYCwwKSk=
- Original source
/********************************************************************
* *
* *
* 1K LZ77 source compression npm module *
* *
* *
* See http://js1k-compress.solsort.com for details *
* *
* *
* *
********************************************************************/
var compress = input => {
var output = ''
for(var i = 0; i < input.length;) {
var best = 0
var bestLength = 0
for(var j = 0; j < i; ++j) {
for(var k = 0; k + j < i && input[k + i] === input[k + j]; ++k) {
}
if(k > bestLength) {
bestLength = k
best = j
}
}
bestLength = Math.min(bestLength, 30)
if(bestLength < 3) {
output += input[i]
++i
} else {
output += String.fromCharCode(best + 2048 * bestLength)
i += bestLength
}
}
output = output
.replace(/\\/g, '\\\\')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\0/g, '\\0')
.replace(/[$]/g, '\\$')
.replace(/`/g, '\\`')
return '(f=(i,o,p,c)=>(c=i.charCodeAt(p))?f(i,o+(c<256?i[p]:o.slice(c&2047,(c&2047)+(c>>11))),++p):o)(`' + output
+ '`,``,0)'
}
if(typeof module === 'object') {
module.exports = compress
} else {
document.write('<pre>' + `
> source.length
${s.length}
> compress(source).length
${compress(s).length}
> compress(source)
${compress(s)}
> eval(compress(source))
${eval(compress(s))}
`.replace(/</g, '<'))
}