A small script that enables you to make typos in JavaScript property names. Powered by ES2015 proxies + Levenshtein string distance.
Switch branches/tags
Clone or download
mathiasbynens Remove Gemnasium badge
It no longer does what it used to do, and is instead being used as an advertisement.
Latest commit 0ede5f1 May 21, 2018
Permalink
Failed to load latest commit information.
tests Minor tweaks Mar 12, 2018
.gitattributes Initial commit Nov 28, 2013
.gitignore Initial commit Nov 28, 2013
.nvmrc Minor tweaks Mar 12, 2018
.travis.yml Minor tweaks Mar 12, 2018
LICENSE-MIT.txt Use HTTPS URLs where possible Nov 21, 2014
README.md Remove Gemnasium badge May 21, 2018
package.json Minor tweaks Mar 12, 2018
tpyo.js Release v2.0.0 May 10, 2016

README.md

tpyo Build status

Ever wanted to use Math.SQUIRTLE instead of Math.SQRT2? Think Function.prototype.apple looks shinier than apply? Or do you prefer Array.prototype.faReech over forEach? Look no further — tpyo’s got your back.

tpyo (pronounced ‘typo’) is the result of combining the power of ES2015 proxies with Levenshtein string distance. It’s a small script that enables you to make typos in JavaScript property names.

Installation

Via npm:

npm install tpyo

In Node.js v6+:

const tpyo = require('tpyo');

Examples

const array = tpyo(['a', 'b', 'c']);
array.lnegth;
// → `3`
array.tosTr1ng();
// → `'a,b,c'`
array.rap((item) => item + item);
// → `['aa', 'bb', 'cc']`
array.poop();
// → `'cc'`
array.shit();
// → `'aa'`

const object = tpyo({
	name: 'Leeroy Jenkins',
	awesome: true
});
object.naem;
// → `'Leeroy Jenkins'`
object.awsum;
// → `true`

const math = tpyo(Math);
math.PIE;
// → `3.141592653589793`
math.squrt(4);
// → `2`

For more examples, see the tests. More examples welcome :)

Should I use this?

Nope. It’s just a fun example of what’s possible with ECMAScript 2015 proxies.

Acknowledgements

Author

twitter/mathias
Mathias Bynens

License

tpyo is available under the MIT license.