uglified
v1.0.1
Published
Checks if the code is minified
Downloads
18
Readme
uglified
Checks if the code is minified.
Install
$ npm install uglified --save
Usage
var minified = require('uglified')
console.log(minified) // `true` or `false`
Features
- targeted at browser environments, when you want to know at runtime if the code is minified or not
- full test-coverage
- simple implementation
Module name inspiration
The module does not have any relation to uglify-js
, but the module name minified
was taken on npm
, so we thought a good alternative name would be uglified
. Probably not the best choice, but does the job anyway.
Implementation details
It uses a function with only an arg (which is never used in the function body), and the function body only containing a comment. It then tests if the toString
of the function returns the same value as the original function code. If it does not, the code is probably minified, so returns true.