Package Exports
- @zippytech/uglified
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@zippytech/uglified) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
uglified
Checks if the code is minified.
Install
$ npm install @zippytech/uglified --save
Usage
var minified = require('@zippytech/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.