Skip to content
A small script that enables you to make typos in JavaScript property names. Powered by ES6 proxies + Levenshtein string distance. https://mths.be/tpyo
JavaScript
Find file
Latest commit 3b157c5 @mathiasbynens Release v1.0.0
Failed to load latest commit information.
tests Add more tests and examples
.gitattributes Initial commit
.gitignore Initial commit
.travis.yml Update dependencies
LICENSE-MIT.txt Use HTTPS URLs where possible
README.md Use ES6
package.json Release v1.0.0
tpyo.js Use ES6

README.md

tpyo Build status Dependency 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 ES6 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 v5+:

var tpyo = require('tpyo');

Make sure to run node with the --harmony-proxies flag:

node --harmony-proxies your-script-using-tpyo.js

Examples

var array = tpyo(['a', 'b', 'c']);
array.lnegth;
// → `3`
array.tosTr1ng();
// → `'a,b,c'`
array.fap(function(item) {
    return item + item;
});
// → `['aa', 'bb', 'cc']`
array.poop();
// → `'cc'`
array.shit();
// → `'aa'`

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

var 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 6 proxies.

Acknowledgements

Author

twitter/mathias
Mathias Bynens

License

tpyo is available under the MIT license.

Something went wrong with that request. Please try again.