zertosh / beautify-with-words Goto Github PK
View Code? Open in Web Editor NEWBeautifies javascript and replaces variable names with unique "long-ish words"
License: MIT License
Beautifies javascript and replaces variable names with unique "long-ish words"
License: MIT License
Like the title says.
In the example you posted, there is a require('backbone'); callback.
Would be kinda smart to use it to define the name of the variable.
Run commands:
$ cat input.js | beautify-with-words
// File: input.js
var e = 45,
f = 45,
k,
l = null;
function m() {
var a = l.getAttribute("src"),
b = document.createElement("a");
b.href = a;
return b.href;
}
becomes
// File: output.js
var e = 45, f = 45, k, l = null;
function m() {
var ener = l.getAttribute("src"), geshu = document.createElement("a");
geshu.href = ener;
return geshu.href;
}
The variable e
, f
, k
, l
, and function name m
should be renamed also.
it would be neat to port this to babel
https://github.com/babel/babili/tree/master/packages/babel-plugin-minify-mangle-names would be a good place to start.
some options like {minLength: 10}
,
so there is a lower probability of name collision
Currently, executable logic is baked into beautify-with-words.js
. This prevents re-use of the module as a node module. One example of this being useful would be packaging the module for browser use (via browserify
) and having a website that allows for beautification with words.
I would suggest a project structure like:
bin/beautify-with-words (require's `lib/index.js`)
lib/index.js (or index.js in `root`)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.