0.1.6 • Published 6 years ago

beardfondle v0.1.6

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

beardfondle

Inspired by WTFJS. This library extends String.prototype to encode and decode strings.

How to Use

//JavaScript
var bf = require('beardfondle');

//TypeScript
import bf = require('beardfondle');

var foo = 'Noodle ocelot';
var bar = foo.beard();

console.log(bar);
// (+{}+[])[+[]]+({}+[])[+!+[]]+({}+[])[+!+[]]+([][[]]+[])[+!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+({}+[])[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+({}+[])[+!+[]]+({}+[])[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]]+({}+[])[+!+[]]+(!![]+[])[+[]]

var baz = bar.fondle();

console.log(baz);
// Noodle ocelot

String.fondle() is not needed to decode the library. Just open any browser console and type console.log((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+({}+[])[!+[]+!+[]]+([][[]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+({}+[])[+!+[]]). Through the magic of JavaScript you will get a string back.

NOTE: String.fondle() does not simply decode they symbols back to characters. The method is a wrapper for eval() with some basic checks to prevent malicious use. DO NOT USE THIS LIBRARY IN PRODUCTION. eval() IS ALMOST NEVER SAFE.

The individual symbols can be accessed by importing the package and accessing the symbols object:

var bf = require('beardfondle');

console.log(bf.symbols.a);
// (![]+[])[+!+[]]

console.log(bf.symbols[" "]);
// ({}+[])[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]

Currently the only characters supported are:

a
b
c
d
e
f
i  (lower)
I  (upper)
j
l
n  (lower)
N  (upper)
o  (lower)
O  (upper)
r
s
t
u
y
0
1
2
3
4
5
6
7
8
9
   (space)
[
]

FAQ

How does it work?

According to WTFJS:

So we try adding [] to false. But due to a number of internal function calls (binary + Operator -> ToPrimitive -> [[DefaultValue]]) we end up converting the right operand to a string:

(![]+[].toString()) // 'false'

Thinking of a string as an array we can access its first character via [0]:

'false'[0] // -> 'f'

That's why only certain letters are supported. So far I've only figured out true, false, NaN, undefined, Infinity, and [object Object].

Why did you make this?

Because I wanted to.

What's with the name?

It can be constructed using only this library.

({}+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]+!+[]]+(![]+[])[+[]]+({}+[])[+!+[]]+([][[]]+[])[+!+[]]+([][[]]+[])[+!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]

I originally chose (![]+[])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+({}+[])[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]]+([][[]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]]+({}+[])[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]] but ultimately decided against it.

Fun

(![]+[])[+[]]+(!![]+[])[!+[]+!+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+({}+[])[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+({}+[])[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+({}+[])[!+[]+!+[]]+([][[]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]+!+[]]+(![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+({}+[])[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+([][[]]+[])[+!+[]+!+[]+!+[]+!+[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[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]
0.1.6

6 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago